<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>计算器</title>
<style type="text/css"></style>
</head>
</head>
<body>
<form action name="Calculator" class="font">
<center><table bgcolor="#aaaaaa" border="1" cellpadding="2" bordercolorlight="#808080" bordercolordark="#FFFFFF" class="font"></center>
<tr>
<td bgcolor="#000080" colspan="5" align="center" ><input name="t1" size="22" value="0" width="100%" class="font"></td>
</tr>
<tr>
<td><input type="button" value=" POWER " name="power" οnclick="powerclick()"></td>
<td><input type="button" value=" Clear " name="clear" οnclick="clearclick()"></td>
<td><input type="button" value=" Back " name="back" οnclick="backclick()"></td>
</tr>
<tr><td><input type="button" value=" 1 " name="B1" οnclick="numclick(this)"></td>
<td><input type="button" value=" 2 " name="B2" οnclick="numclick(this)"></td>
<td><input type="button" value=" 3 " name="B3" οnclick="numclick(this)"></td>
<td><input type="button" value=" 4 " name="B4" οnclick="numclick(this)"></td>
</tr>
<tr>
<td><input type="button" value=" 5 " name="B5" οnclick="numclick(this)"></td>
<td><input type="button" value=" 6 " name="B6" οnclick="numclick(this)"></td>
<td><input type="button" value=" 7 " name="B7" οnclick="numclick(this)"></td>
<td><input type="button" value=" 8 " name="B8" οnclick="numclick(this)"></td>
</tr>
<tr>
<td><input type="button" value=" 9 " name="B9" οnclick="numclick(this)"></td>
<td><input type="button" value=" 0 " name="B0" οnclick="numclick(this)"></td>
<td><input type="button" value=" . " name="B11" οnclick="numclick(this)"></td>
<td><input type="button" value=" = " name="BE" οnclick="equalclick()"></td>
</tr>
<p align="center">
<td><input type="button" value=" + " name="BP" οnclick="symbolclick(this)"></td>
<td><input type="button" value=" - " name="BJ" οnclick="symbolclick(this)"></td>
<td><input type="button" value=" * " name="BM" οnclick="symbolclick(this)"></td>
<td><input type="button" value=" / " name="BD" οnclick="symbolclick(this)"></td>
</tr>
</form>
<script>
<!--
var flag=0
var add1
var s1
function numclick(b)
{
if (flag==0)
{
document.forms[0].t1.value=""
flag=1
}
document.forms[0].t1.value=document.forms[0].t1.value+b.value.substring(2,3)
}
function symbolclick(b)
{
switch (s1)
{
case '*':
document.forms[0].t1.value=String(Number(document.forms[0].t1.value)*add1)
break
case '/':
document.forms[0].t1.value=String(add1/Number(document.forms[0].t1.value))
break
case '+':
document.forms[0].t1.value=String(add1+Number(document.forms[0].t1.value))
break
case '-':
document.forms[0].t1.value=String(add1-Number(document.forms[0].t1.value))
break
}
add1=Number(document.forms[0].t1.value)
s1=b.value.substring(2,3)
flag=0
}
function equalclick()
{
switch (s1)
{
case '*':
document.forms[0].t1.value=String(Number(document.forms[0].t1.value)*add1)
break
case '/':
document.forms[0].t1.value=String(add1/Number(document.forms[0].t1.value))
break
case '+':
document.forms[0].t1.value=String(add1+Number(document.forms[0].t1.value))
break
case '-':
document.forms[0].t1.value=String(add1-Number(document.forms[0].t1.value))
break
}
flag=0
s1=''
}
function clearclick()
{
document.forms[0].t1.value='0.'
add1=0
s1=''
flag=0
}
function backclick()
{
if (document.forms[0].t1.value.length==1)
{
document.forms[0].t1.value="0."
flag=0
}
else
document.forms[0].t1.value=document.forms[0].t1.value.substring(0,document.forms[0].t1.value.length-1)
}
function powerclick()
{
document.forms[0].t1.value=String(Number(document.forms[0].t1.value)*Number(document.forms[0].t1.value))
add1=Number(document.forms[0].t1.value)
}
-->
</script>
</body>
</html>