Advertisement
aviel900

Simple Calculator

Aug 25th, 2019
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.07 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Simple Calculator</title>
  4. </head>
  5.  <body>
  6.  <form name="Calculator">
  7.   <table>
  8.     <tr>
  9.       <td colspan="4">
  10.         <input type="text" name="display" id="display" disabled>
  11.       </td>
  12.     </tr>
  13.     <tr>
  14.       <td> <input type="button" name="one" value="1" onclick="Calculator.display.value += '1'"> </td>
  15.       <td> <input type="button" name="two" value="2" onclick="Calculator.display.value += '2'"> </td>
  16.       <td> <input type="button" name="three" value="3" onclick="Calculator.display.value += '3'"> </td>
  17.       <td> <input type="button" class="operator" name="plus" value="+" onclick="Calculator.display.value += '+'"> </td>
  18.     </tr>
  19.     <tr>
  20.       <td> <input type="button" name="four" value="4" onclick="Calculator.display.value += '4'"> </td>
  21.       <td> <input type="button" name="five" value="5" onclick="Calculator.display.value += '5'"> </td>
  22.       <td> <input type="button" name="six" value="6" onclick="Calculator.display.value += '6'"> </td>
  23.       <td> <input type="button" class="operator" name="minus" value="-" onclick="Calculator.display.value += '-'"> </td>
  24.     </tr>
  25.     <tr>
  26.       <td> <input type="button" name="seven" value="7" onclick="Calculator.display.value += '7'"> </td>
  27.       <td> <input type="button" name="eight" value="8" onclick="Calculator.display.value += '8'"> </td>
  28.       <td> <input type="button" name="nine" value="9" onclick="Calculator.display.value += '9'"> </td>
  29.       <td> <input type="button" class="operator" name="times" value="x" onclick="Calculator.display.value += '*'"> </td>
  30.     </tr>
  31.     <tr>
  32.       <td> <input type="button" id="clear" name="clear" value="c" onclick="Calculator.display.value = ''"> </td>
  33.       <td> <input type="button" name="zero" value="0" onclick="Calculator.display.value += '0'"> </td>
  34.       <td> <input type="button" name="doit" value="=" onclick="Calculator.display.value = eval(Calculator.display.value)"> </td>
  35.       <td> <input type="button" class="operator" name="div" value="/" onclick="Calculator.display.value += '/'"> </td>
  36.     </tr>
  37.   </table>
  38.  </form>
  39.  </body>
  40. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement