Advertisement
Crazykk1449

Calculator Code

Mar 22nd, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.50 KB | None | 0 0
  1. <!DOCTYPE html>
  2.     <html>
  3.         <head>
  4.  
  5.             <title>Test Page</title>
  6.  
  7.         </head>
  8.         <body>
  9.  
  10.             <form name="calculator">
  11.  
  12.                 <input type="button" value="1" onClick="document.calculator.ans.value+='1'">
  13.                 <input type="button" value="2" onClick="document.calculator.ans.value+='2'">
  14.                 <input type="button" value="3" onClick="document.calculator.ans.value+='3'">
  15.                 <input type="button" value="4" onClick="document.calculator.ans.value+='4'">
  16.                 <input type="button" value="5" onClick="document.calculator.ans.value+='5'">
  17.                 <input type="button" value="6" onClick="document.calculator.ans.value+='6'">
  18.                 <input type="button" value="7" onClick="document.calculator.ans.value+='7'">
  19.                 <input type="button" value="8" onClick="document.calculator.ans.value+='8'">
  20.                 <input type="button" value="9" onClick="document.calculator.ans.value+='9'">
  21.                 <input type="button" value="0" onClick="document.calculator.ans.value+='0'">
  22.                 <input type="button" value="+" onClick="document.calculator.ans.value+='+'">
  23.                 <input type="button" value="-" onClick="document.calculator.ans.value+='-'">
  24.                 <input type="button" value="/" onClick="document.calculator.ans.value+='/'">
  25.                 <input type="button" value="*" onClick="document.calculator.ans.value+='*'">
  26.                 <input type="button" value="=" onClick="document.calculator.ans.value=eval(document.calculator.ans.value)">
  27.                 <input type="reset" value="Reset">
  28.  
  29.                 <br>Solution is <input type="textfield" name="ans" value="">
  30.  
  31.             </form>
  32.  
  33.         </body>
  34.  
  35.     </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement