WWW.COOCC.COM 脚本展示
pc.yzdown.com 计算器
以下代码加入<head>区域
以下代码加入<body>区域
<br> <script language="JavaScript"> <!-- Hide the script from old browsers -- function compute(obj) {obj.expr.value = eval(obj.expr.value)} var one = '1' var two = '2' var three = '3' var four = '4' var five = '5' var six = '6' var seven = '7' var eight = '8' var nine = '9' var zero = '0' var plus = '+' var minus = '-' var multiply = '*' var divide = '/' var decimal = '.' function enter(obj, string) {obj.expr.value += string} function clear(obj) {obj.expr.value = ''} // --End Hiding Here --> </script> <form name="calc"> <table border=1> <td colspan=4> <input type="text" name="expr" size=30 action="compute(this.form)"> <tr> <td> <input type="button" value=" 7 " onClick="enter(this.form, seven)" name="button"> <td> <input type="button" value=" 8 " onClick="enter(this.form, eight)" name="button"> <td> <input type="button" value=" 9 " onClick="enter(this.form, nine)" name="button"> <td> <input type="button" value=" / " onClick="enter(this.form, divide)" name="button"> <tr> <td> <input type="button" value=" 4 " onClick="enter(this.form, four)" name="button"> <td> <input type="button" value=" 5 " onClick="enter(this.form, five)" name="button"> <td> <input type="button" value=" 6 " onClick="enter(this.form, six)" name="button"> <td> <input type="button" value=" * " onClick="enter(this.form, multiply)" name="button"> <tr> <td> <input type="button" value=" 1 " onClick="enter(this.form, one)" name="button"> <td> <input type="button" value=" 2 " onClick="enter(this.form, two)" name="button"> <td> <input type="button" value=" 3 " onClick="enter(this.form, three)" name="button"> <td> <input type="button" value=" - " onClick="enter(this.form, minus)" name="button"> <tr> <td colspan=2> <input type="button" value=" 0 " onClick="enter(this.form, zero)" name="button"> <td> <input type="button" value=" . " onClick="enter(this.form, decimal)" name="button"> <td> <input type="button" value=" + " onClick="enter(this.form, plus)" name="button"> <tr> <td colspan=2> <input type="button" value=" = " onClick="compute(this.form)" name="button"> <td colspan=2> <input type="reset" value="AC" size= 3 onClick="clear(this.form)" name="Reset"> </table> </form>
可能某段代码会由于COPY时的不小心以至不能正常显示,如发现此情况,请告知 pc.yzdown.com