Advertisement
Shailrshah

Basic Calculator

Feb 18th, 2014
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <head>
  3. <title>My Calculator</title>
  4. </head>
  5. <body>
  6.     <table border = "1"><tr><td>
  7.     <form name = "calc">
  8.         <h4>My JS Calculator</h4>
  9.         <input type = "text" name = "display" size = "12" style ="text-align: right;"/>
  10.         <br><br>
  11.         <input type = "button" name = "clear" value = "CLR" onclick = "calc.display.value = ''">
  12.         <br><br>
  13.         <input type = "button" name = "seven" value = "7" onclick = "calc.display.value += '7'">
  14.         <input type = "button" name = "eight" value = "8" onclick = "calc.display.value += '8'">
  15.         <input type = "button" name = "nine" value = "9" onclick = "calc.display.value += '9'">
  16.         <input type = "button" name = "divide" value = "/" onclick = "calc.display.value += '/'">
  17.         <br>
  18.         <input type = "button" name = "four" value = "4" onclick = "calc.display.value += '4'">
  19.         <input type = "button" name = "five" value = "5" onclick = "calc.display.value += '5'">
  20.         <input type = "button" name = "six" value = "6" onclick = "calc.display.value += '6'">
  21.         <input type = "button" name = "multiply" value = "*" onclick = "calc.display.value += '*'">
  22.         <br>
  23.         <input type = "button" name = "one" value = "1" onclick = "calc.display.value += '1'">
  24.         <input type = "button" name = "two" value = "2" onclick = "calc.display.value += '2'">
  25.         <input type = "button" name = "three" value = "3" onclick = "calc.display.value += '3'">
  26.         <input type = "button" name = "subtract" value = "-" onclick = "calc.display.value += '-'">
  27.         <br>
  28.         <input type = "button" name = "decimal" value = "." onclick = "calc.display.value += '.'">
  29.         <input type = "button" name = "zero" value = "0" onclick = "calc.display.value += '0'">
  30.         <input type = "button" name = "equals" value = "=" onclick = "calc.display.value = eval(calc.display.value)">
  31.         <input type = "button" name = "add" value = "+" onclick = "calc.display.value += '+'">
  32.         <br>
  33.     </form>
  34.     </td></tr></table>
  35. </body>
  36. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement