日期:2014-05-18  浏览次数:20684 次

简单的计算器
这是个再简单不过的WEB计算器了:

<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 ">
<title> 简单计算器 </title>
<script   language= "javascript ">
var   x,y,z;


function   calc(x,string)
{
document.myform.display.value=x+string;

}
function   calcend(str)
{

document.myform.display.value=eval(str);

}
function   clears()
{
document.myform.display.value= " ";
}

</script>
</head>

<body>
<form   name= "myform ">
<table       bgcolor= "#999999 "   align= "center "   style= "font-size:14px   "   width= "180 "   height= "220 "border= "1 "   bordercolor= "#00FF99 ">
<caption   align= "center "> <h1> 计算器 </h1> </caption>
<tr>
<td   colspan= "2 "> <input   type= "text "   name= "display "   style= "font: '楷体_GB2312 ';height:35px   "   maxlength= "25 "> </td>
<td> <input   style= "font-size:28px;width:40;height:40; "   type= "button "   name= "clear "   value= "C "   onClick= "clears() "> </td>
</tr>

<tr   align= "center ">
<td> <input   style= "   font-size:28px;width:40;height:40; "     type= "button "   name= "1 "   value= "1 "   onClick= "calc(this.form.display.value, '1 ') "> </td>
<td> <input   style= "font-size:28px;width:40;height:40; "   type= "button "   name= "2 "   value= "2 "   onClick= "calc(this.form.display.value, '2 ') "> </td>
<td> <input   style= "font-size:28px;width:40;height:40; "   type= "button "   name= "3 "   value= "3 "   onClick= "calc(this.form.display.value, '3 ') "> </td>


</tr>
<tr   align= "center ">
<td> <input   style= "font-size:28px;width:40;height:40; "   type= "button "   name= "4 "   value= "4 "   onClick= "calc(this.form.display.value, '4 ') "> </td>
<td> <input   style= "font-size:28px;width:40;height:40; "   type= "button "   name= "5 "   value= "5 "   onClick= "calc(this.form.display.value, '5 ') "> </td>
<td> <input   style= "font-size:28px;width:40;height:40; "   type= "button "   name= "6 "   value= "6 "   onClick= "calc(this.form.display.value, '6 ') "> </td>


</tr>
<tr   align= "center ">
<td> <input   style= "font-size:28px;width:40;height:40; "   type= "button "   name= "7 "   value= "7 "   onClick= "calc(this.form.display.value, '7 ') "> </td>
<td> <input   style= "font-size:28px;width