<html>
<head><script language="javascript">
<!--
var n1='',n2='';
var item1_flag=true;
var opr_type='+';
function setval(item)
{ document.cal.outtext.value+=item;
if(item1_flage==1)
n1+=item;
else n2+=item;
}
function setopr(opr)
{document.cal.outtext.value+=opr;
item1_flag=false;
opr_type=opr;
}
function clear()
{document.cal.outtext.value='';
item1.flat=true;
opr_type='+';
n1='';n2='';
}
function computer(obj)
{var result='' ;
if((eval(n2)==0)&&(opr_type=="/"))
{alert("除数不能为0!");
clear();
return;
}
else
{result=eval(obj.outtext.value);
document.cal.outtext.value+='=';
document.cal.outtext.value+=result;
}
}
-->
</script>
<title>无标题文档</title>
</head>
<body>
<p align=center><form name="cal">
<input type="text"value=""name="outtext"><br><br>
<input type="button"value="0"onclick="setvalue('0')">
<input type="button"value="1"onclick="setvalue('1')">
<input type="button"value="2"onclick="setvalue('2')">
<input type="button"value="3"onclick="setvalue('3')"><br><br>
<input type="button"value="4"onclick="setvalue('4')">
<input type="button"value="5"onclick="setvalue('5')">
<input type="button"value="6"onclick="setvalue('6')">
<input type="button"value="7"onclick="setvalue('7')"><br><br>
<input type="button"value="8"onclick="setvalue('8')">
<input type="button"value="9"onclick="setvalue('9')">
<input type="button"value="+"onclick="setopr('+')">
<input type="button"value="-"onclick="setopr('-')"><br><br>
<input type="button"value="*"onclick="setopr('*')">
<input type="button"value="/"onclick="setopr("/")">
<input type="button"value="ce"onclick="clear()">
<input type="button"value="="onclick="computer(this.form)">
</form></p>
</body>
</html>