请问下面这道JavaScript题怎么做?求讲解!谢谢!
1个回答
展开全部
<html>
<head>
<title>收银</title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
</head>
单价:<input name="price" id="price"></input><br>
数量:<input name="count" id="count"></input><br>
<input type="button" value="计算" onclick="calc()"></input><br>
<script>
function calc(){
var price = document.getElementById("price").value;
var count = document.getElementById("count").value;
alert("应付金额为:"+price*count);
}
</script>
</html>
<head>
<title>收银</title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
</head>
单价:<input name="price" id="price"></input><br>
数量:<input name="count" id="count"></input><br>
<input type="button" value="计算" onclick="calc()"></input><br>
<script>
function calc(){
var price = document.getElementById("price").value;
var count = document.getElementById("count").value;
alert("应付金额为:"+price*count);
}
</script>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询