<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>计算器</title>
<script language="javascript">
function BackSpace(){
var suanshi
suanshi=show.value
if(suanshi!=""){
suanshi=suanshi.substring(0,suanshi.length-1)
}
show.value=suanshi
}
function ReSet(){
show.value=""
}
function DaoShu(){
if(show.value!="")
show.value=1/show.value
}
function ZhengFu(){
var suanshi
suanshi=show.value
FuHao=suanshi.substring(0,1)
if(FuHao=="-")
suanshi=suanshi.substring(1,suanshi.length)
else suanshi="-"+suanshi
show.value=suanshi
}
function Button(a){
show.value=show.value+a
}
function Result(){
show.value=eval(show.value)
}
</script>
</head>
<body>
<p align="center"><font size="4"> 计算器</font></p>
<div align="center">
<table border="4" width="362" height="324" style="border-collapse: collapse" bordercolor="#0066CC" bgcolor="#CC99FF">
<tr>
<td height="40" width="352" colspan="5" align="right"><p align="center">
<input name="show" size="20" style="width: 352; height: 40; font-size: 18pt; color:#0000FF; background-color:#99FFCC" disabled >
</td>
</tr>
<tr>
<td height="49" width="138" colspan="2" align="center"><input type="button" value="BackSpace" name="B3" style="width: 100; height: 35; font-size: 14pt" onClick="BackSpace()">
</td>
<td height="49" width="133" colspan="2" align="center"><input type="button" value="ReSet" style="width: 100; height: 35; font-size: 14pt" onClick="ReSet()"></td>
<td height="49" width="69" align="center"><input type="button" value="1/x" name="B5" style="width: 50; height: 35; font-size: 14pt" onClick="DaoShu()"></td>
</tr>
<tr>
<td height="25%" width="20%" align="center"><input type="button" value="7" name="B6" style="width: 50; height: 35; font-size: 14pt" onClick="Button('7')"></td>
<td height="25%" width="20%" align="center"><input type="button" value="8" name="B7" style="width: 50; height: 35; font-size: 14pt" onClick="Button('8')"></td>
<td height="25%" width="20%" align="center"><input type="button" value="9" name="B8" style="width: 50; height: 35; font-size: 14pt" onClick="Button('9')"></td>
<td height="25%" width="20%" align="center"><input type="button" value="/" name="B9" style="width: 50; height: 35; font-size: 14pt" onClick="Button('/')"></td>
<td height="25%" width="20%" align="center"><input type="button" value="(" name="B10" style="width: 50; height: 35; font-size: 14pt" onClick="Button('(')"></td>
</tr>
<tr>
<td height="25%" width="20%" align="center"><input type="button" value="4" name="B11" style="width: 50; height: 35; font-size: 14pt" onClick="Button('4')"></td>
<td height="25%" width="20%" align="center"><input type="button" value="5" name="B12" style="width: 50; height: 35; font-size: 14pt" onClick="Button('5')"></td>
<td height="25%" width="20%" align="center"><input type="button" value="6" name="B13" style="width: 50; height: 35; font-size: 14pt" onClick="Button('6')"></td>
<td height="25%" width="20%" align="center"><input type="button" value="*" name="B14" style="width: 50; height: 35; font-size: 14pt" onClick="Button('*')"></td>
<td height="25%" width="20%" align="center"><input type="button" value=")" name="B15" style="width: 50; height: 35; font-size: 14pt" onClick="Button(')')"></td>
</tr>
<tr>
<td height="25%" width="20%" align="center"><input type="button" value="1" name="B16" style="width: 50; height: 35; font-size: 14pt" onClick="Button('1')"></td>
<td height="25%" width="20%" align="center"><input type="button" value="2" name="B17" style="width: 50; height: 35; font-size: 14pt" onClick="Button('2')"></td>
<td height="25%" width="20%" align="center"><input type="button" value="3" name="B18" style="width: 50; height: 35; font-size: 14pt" onClick="Button('3')"></td>
<td height="25%" width="20%" align="center"><input type="button" value="-" name="B19" style="width: 50; height: 35; font-size: 14pt" onClick="Button('-')"></td>
<td height="25%" width="20%" align="center"><input type="button" value="%" name="B20" style="width: 50; height: 35; font-size: 14pt" onClick="Button('%')"></td>
</tr>
<tr>
<td height="25%" width="20%" align="center"><input type="button" value="0" name="B21" style="width: 50; height: 35; font-size: 14pt" onClick="Button('0')"></td>
<td height="25%" width="20%" align="center"><input type="button" value="+/-" name="B22" style="width: 50; height: 35; font-size: 14pt" onClick="ZhengFu()"></td>
<td height="25%" width="20%" align="center"><input type="button" value="." name="B23" style="width: 50; height: 35; font-size: 14pt" onClick="Button('.')"></td>
<td height="25%" width="20%" align="center"><input type="button" value="+" name="B24" style="width: 50; height: 35; font-size: 14pt" onClick="Button('+')"></td>
<td height="25%" width="20%" align="center"><input type="button" value="=" name="B25" style="width: 50; height: 35; font-size: 14pt" onClick="Result()" ></td>
</tr>
</table>
</div>
</body>
</html>