计算器(二).txt

来自「这个是 Java Script特效(新),」· 文本 代码 · 共 59 行

TXT
59
字号
计算器(二)
脚本说明:
把如下代码加入<body>区域中
<script language="JavaScript">

<!--

function equa1() {
        a = document.form1.aa.value;
        b = document.form1.ab.value;
        c = a-b;
        document.form1.total1.value = c
        }
function equa2() {
        a = document.form1.ba.value;
        b = document.form1.bb.value;
        c = (a*1)+(b*1);
        document.form1.total2.value = c
        }
function equa3() {
        a = document.form1.ca.value;
        b = document.form1.cb.value;
        c = a/b;
        document.form1.total3.value = c
        }
function equa4() {
        a = document.form1.da.value;
        b = document.form1.db.value;
        c = a*b;
        document.form1.total4.value = c
        }
//-->

</script>
<form name="form1"><center>
<table border=1 cellpadding=1 cellspacing=1>
<tr>
<td><input type="text" size=5 name="aa"> - <input type="text" name="ab" size=5></td>
<td> =<input type="text" name="total1" size=5></td>
<td><input type="button" value="Calculate" onClick="equa1()"></td>
<tr>
<td><input type="text" size=5 name="ba"> + <input type="text" name="bb" size=5></td>
<td> =<input type="text" name="total2" size=5></td>
<td><input type="button" value="Calculate" onClick="equa2()"></td>
<tr>
<td><input type="text" size=5 name="ca"> / <input type="text" name="cb" size=5></td>
<td>=<input type="text" name="total3" size=5></td>
<td><input type="button" value="Calculate" onClick="equa3()"></td>
<tr>
<td><input type="text" size=5 name="da"> * <input type="text" name="db" size=5></td>
<td> =<input type="text" name="total4" size=5></td>
<td><input type="button" value="Calculate" onClick="equa4()"></td>
<tr>
<td colspan=3 align=center>
<input type="reset" value="Reset"></td>
</table>
</form>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?