<!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=utf-8" />
<title>简易计算器</title>
<script type="text/javascript">
function plus()
{var a;var b;var r;
a=parseFloat(document.getElementById("num1").value);
b=parseFloat(document.getElementById("num2").value);
r=a+b; document.getElementById("result").value=r;
}
function minus()
{var a;var b;var r;
a=parseFloat(document.getElementById("num1").value);
b=parseFloat(document.getElementById("num2").value);
r=a-b; document.getElementById("result").value=r;
}
function multiple()
{var a; var b; var r;
a=parseFloat(document.getElementById("num1").value);
b=parseFloat(document.getElementById("num2").value);
r=a*b; document.getElementById("result").value=r;
}
function divide()
{var a;var b;var r;
a=parseFloat(document.getElementById("num1").value);
b=parseFloat(document.getElementById("num2").value);
r=a/b; document.getElementById("result").value=r;
}
function clear()
{
document.getElementById("num1").value="";
document.getElementById("num2").value="";
document.getElementById("result").value="";
}
</script>
</head>
<body>
<form>
<table>
<tr>
<p style="display:inline"><font color="#FF9966" size="+2">购物车</font></p> <p style="display:inline"><font color="#FF9966" size="+1">简易计算器</font></p>
</tr>
<tr><td>第一个数:</td><td colspan="3" width="300px"><input type="text" size="38" name="num1" id="num1"></td></tr>
<tr ><td>第二个数:</td><td colspan="3" width="300px"><input type="text" size="38"name="num2" id="num2"></td></tr>
<tr><td><input type="button" value="﹢" onclick="plus()"></td>
<td><input type="button" value="﹣" onclick="minus()"></td>
<td><input type="button" value="×" onclick="multiple()"></td>
<td><input type="button" value="÷" onclick="divide()"></td></tr>
<tr><td><p style="text-align:center">结果:</p></td><td colspan="3" width="300px"><input type="text" size="38" name="result" id="result"></td></tr>
<tr><td><input type="button" value="CE" onclick="clear()"></td></tr>
</table>
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>简易计算器</title>
<script type="text/javascript">
function plus()
{var a;var b;var r;
a=parseFloat(document.getElementById("num1").value);
b=parseFloat(document.getElementById("num2").value);
r=a+b; document.getElementById("result").value=r;
}
function minus()
{var a;var b;var r;
a=parseFloat(document.getElementById("num1").value);
b=parseFloat(document.getElementById("num2").value);
r=a-b; document.getElementById("result").value=r;
}
function multiple()
{var a; var b; var r;
a=parseFloat(document.getElementById("num1").value);
b=parseFloat(document.getElementById("num2").value);
r=a*b; document.getElementById("result").value=r;
}
function divide()
{var a;var b;var r;
a=parseFloat(document.getElementById("num1").value);
b=parseFloat(document.getElementById("num2").value);
r=a/b; document.getElementById("result").value=r;
}
function clear()
{
document.getElementById("num1").value="";
document.getElementById("num2").value="";
document.getElementById("result").value="";
}
</script>
</head>
<body>
<form>
<table>
<tr>
<p style="display:inline"><font color="#FF9966" size="+2">购物车</font></p> <p style="display:inline"><font color="#FF9966" size="+1">简易计算器</font></p>
</tr>
<tr><td>第一个数:</td><td colspan="3" width="300px"><input type="text" size="38" name="num1" id="num1"></td></tr>
<tr ><td>第二个数:</td><td colspan="3" width="300px"><input type="text" size="38"name="num2" id="num2"></td></tr>
<tr><td><input type="button" value="﹢" onclick="plus()"></td>
<td><input type="button" value="﹣" onclick="minus()"></td>
<td><input type="button" value="×" onclick="multiple()"></td>
<td><input type="button" value="÷" onclick="divide()"></td></tr>
<tr><td><p style="text-align:center">结果:</p></td><td colspan="3" width="300px"><input type="text" size="38" name="result" id="result"></td></tr>
<tr><td><input type="button" value="CE" onclick="clear()"></td></tr>
</table>
</form>
</body>
</html>