An ordinary calculator.

Source: Internet
Author: User
Tip: You can modify some of the code before running

<ptml> <pead> <meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "> <title> a more common calculator </title> </pead> <body> <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 ' VA R 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 Hidi ng here--> </script> <form name= "Calc" > <table border=1> <td Colspan=4><input "Tex T "name=" expr "size=30 action=" compute (this.form) "> <tr> <td><input type=" button "value=" 7 "OnClick = "Enter (This.form, seven)" > <td><input type= "butTon "value=" 8 "onclick=" Enter (This.form, eight) "> <td><input type=" button "value=" 9 "onclick=" Enter (t His.form, nine) "> <td><input type=" button "value="/"onclick=" Enter (This.form, divide) "> <tr>& Lt;td><input type= "button" value= "4" onclick= "Enter (This.form, four)" > <td><input type= "button" Val Ue= "5" onclick= "Enter (This.form, five)" > <td><input type= "button" value= "6" onclick= "Enter (This.form, Six) "> <td><input type=" button "value=" * "onclick=" enter (this.form, multiply) "> <tr><td> <input type= "button" value= "1" onclick= "Enter (This.form, one)" > <td><input type= "button" value= "2" onclick= "Enter (This.form, two)" > <td><input type= "button" value= "3" onclick= "Enter (This.form, three)" " ; <td><input type= "button" value= "-" onclick= "Enter (This.form, minus)" > <tr><td colspan=2>< Input type= "button" VAlue= "0" onclick= "Enter (This.form, zero)" > <td><input type= "button" value= ". "Onclick=" Enter (This.form, decimal) "> <td><input type=" button "value=" + "onclick=" Enter (This.form, plus) "> <tr><td colspan=2><input type=" button "value=" = "onclick=" Compute (this.form) "> &LT;TD cols Pan=2><input type= "button" value= "AC" size= 3 onclick= "Clear (this.form)" > </table> </form> </b Ody> </ptml>
Tip: You can modify some of the code before running

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.