js这个加减乘除为什么使用不了?看不出问题啊
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function compute(op)
{
var num1,num2;
num1=parseFloat(document.form1.textnum1.value);
num2=parseFloat(document.form1.textnum2.value);
if (op=="+")
document.form1.result.value=num1+num2;
if (op=="-")
document.form1.result.value=num1-num2;
if (op=="*")
document.form1.result.value=num1*num2;
if (op=="/" && num2!=0)
document.form1.result.value=num1/num2;
}
</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="120" height="26">第一个数:</td>
<td width="380"><label>
<input type="text" name="textnum1" />
</label></td>
</tr>
<tr>
<td height="27">第二个数:</td>
<td><label>
<input type="text" name="textnum2" />
</label></td>
</tr>
<tr>
<td height="23" colspan="2"><label>
<input name="addbutton" type="submit" id="addbutton" value=" + " onclick="compute()" />
<input type="submit" name="subbutton" value=" - " onclick="compute('-')" />
<input type="submit" name="mulbutton" value=" × " onclick="compute('*')"/>
<input type="submit" name="divbutton" value=" ÷ " onclick="compute('/')" />
</label></td>
</tr>
<tr>
<td>计算结果:</td>
<td><label>
<input type="text" name="result" />
</label></td>
</tr>
</table>
</form>
</body>
</html>