<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<script type="text/javascript">
var a = doucment.getElementById("text1").value;
a = Number(a);
var b = doucment.getElementById("text2").value;
a = Number(b);
var c;
function showsum(){
c = a + b;
return c;
}
function showless(){
c = a - b;
return c;
}
function showsmul(){
c = a * b;
return c;
}
function showdiv(){
c = a / b;
return c;
}
</script>
<style>
p{
text-align:center;
font-family:"华文行楷";
font-size:30px;
}
</style>
<body>
<p>
购物简易计算器
</p>
<form method="post" action=" ">
第一个数:
<input type ="text" id="text1"/><br />
第二个数:<input type="text" id="text2"/><br />
<input type="button" id="button1" value="+" onclick="showsum()"/>
<input type="button" id="button2" value="-" onclick="showless()" />
<input type="button" id="button2" value="*" onclick="showmul()" />
<input type="button" id="button2" value="/" onclick="showdiv()" />
<br />
计算结果:<input type="text" id ="text3" value=c />
</form>
</body>
为什么下面计算结果的text得不到值啊。。。新人初来乍到。。。啥都不懂啊