这篇文章上次修改于 985 天前,可能其部分内容已经发生变化,如有疑问可询问作者。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<div id="qiuhe">
请输入金额:<input type="text" name="price" id="price" value="" /><br />
请输入数量:<input type="text" name="num" id="num" value="" />
<button type="button" id="tijiao">提交</button>
</div>
<script type="text/javascript">
var tijiao = document.getElementById("tijiao");
tijiao.onclick = function(){
var price = document.getElementById("price").value;
var num = document.getElementById("num").value;
console.log(price);
var sum1 = price*num;
window.alert("你要求的乘积是:" + sum1);
}
</script>
</body>
</html>
没有评论