日期:2014-05-17 浏览次数:20907 次
<html>
<head>
<title>计算器</title>
<script type="text/javascript">
function compute(op)
{
var num1, num2;
num1 = parseFloat(document.myform.txtnum1.value);
num2 = parseFloat(document.myform.txtnum2.value);
if (op == "+")
document.myform.txtresult.value = num1 + num2;
if (op == "-")
document.myform.txtresult.value = num1 - num2;
if (op=="*")
document.myform.txtresult.value = num1 * num2;
if (op=="/"&& num2!=0)
document.myform.txtresult.value = num1 / num2;
}
function closewindow()
{
if (window.confirm("你确定要退出系统吗"))
window.close();
}
</script>
</head>
<body>
<form action ="" method ="post" name="myform" id="myform">
<table border="0" bgcolor="#c9e491" align="center">
<tr>
<td colspan="4"><h3>简易计算器</h3></td>
</tr>
<tr>
<td>第一个数</td>
<td colspan="3"><input name ="txtnum1" type="text" class="textbaroder" id="txtnum1" size ="25" /></td>
</tr>
<tr>
<td>第二个数</td>
<td colspan="3"><input name ="txtnum2" type="text" class="textbaroder" id="Textnum2" size ="25" /></td>
</tr>
<tr>
&l