请大家帮忙看一下这段代码的错误,应该怎么修改
<!DOCTYPE html><html>
<head>
<meta charset="UTF-8">
<title>数字计算器</title>
<script>
var objDisdiv = document.getElementById("disdiv");
var objNum1div = document.getElementById("num1");
var objNum2div = document.getElementById("num2");
function addcirculater(){
var num1 = Number(objNum1div.value);
var num2 = Number(objNum2div.value) ;
var addNum = num1+num2;
objDisdiv.innerHTML = addNum;
}
function subcirculater(){
var num1 = objNum1div.value;
var num2 = objNum2div.value;
var subNum = num1 - num2;
objDisdiv.innerHTML = subNum;
}
function mutcirculater(){
var num1 = objNum1div.value;
var num2 = objNum2div.value;
var mutNum = num1 * num2;
objDisdiv.innerHTML = mutNum;
}
function divcirculater(){
var num1 = objNum1div.value;
var num2 = objNum2div.value;
var divNum = num1 / num2;
objDisdiv.innerHTML = divNum;
}
</script>
<style>
#disdiv{
height: 50px;
}
</style>
</head>
<body>
<div id="div">
请输入第一个数字:<input type="text" id ="num1" /><br />
请输入第二个数字:<input type="text" id ="num2" /><br />
<button type="button" id="addbu" onclick="addcirculater()">+</button>
<button type="button" id="subbu" onclick="subcirculater()">-</button>
<button type="button" id="mutbu" onclick="mutcirculater()">*</button>
<button type="button" id="divbu" onclick="divcirculater()">/</button>
</div>
<h3>计算结果:</h3>
<div id = "disdiv">
</div>
</body>
</html>
错在哪?
页:
[1]