Advertisement
Booster

Simple calculator

Feb 15th, 2015
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 2.27 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  5.         <title>Calculator</title>
  6.         <link rel="stylesheet" href="css/calculator.css" type="text/css">
  7.     </head>
  8.     <body>
  9.     <form name="calculator">
  10.         <table id="main-table">
  11.             <thead>
  12.                 <tr>
  13.                     <td id="screen "colspan="4">
  14.                         <input type="text" name="ans">
  15.                     </td>
  16.                 </tr>
  17.             </thead>
  18.             <tbody>
  19.                 <tr>
  20.                     <td>
  21.                         <input type="button" value="1" onclick="document.calculator.ans.value+='1'">
  22.                     </td>
  23.                     <td>
  24.                         <input type="button" value="2" onclick="document.calculator.ans.value+='2'">
  25.                     </td>
  26.                     <td>
  27.                         <input type="button" value="3" onclick="document.calculator.ans.value+='3'">
  28.                     </td>
  29.                     <td>
  30.                         <input type="button" value="+" onclick="document.calculator.ans.value+='+'">
  31.                     </td>
  32.                 </tr>
  33.                 <tr>
  34.                     <td>
  35.                         <input type="button" value="4" onclick="document.calculator.ans.value+='4'">
  36.                     </td>
  37.                     <td>
  38.                         <input type="button" value="5" onclick="document.calculator.ans.value+='5'">
  39.                     </td>
  40.                     <td>
  41.                         <input type="button" value="6" onclick="document.calculator.ans.value+='6'">
  42.                     </td>
  43.                     <td>
  44.                         <input type="button" value="-" onclick="document.calculator.ans.value+='-'">
  45.                     </td>
  46.                 </tr>
  47.                 <tr>
  48.                     <td>
  49.                         <input type="button" value="7" onclick="document.calculator.ans.value+='7'">
  50.                     </td>
  51.                     <td>
  52.                         <input type="button" value="8" onclick="document.calculator.ans.value+='8'">
  53.                     </td>
  54.                     <td>
  55.                         <input type="button" value="9" onclick="document.calculator.ans.value+='9'">
  56.                     </td>
  57.                     <td>
  58.                         <input type="button" value="*" onclick="document.calculator.ans.value+='*'">
  59.                     </td>
  60.                 </tr>
  61.             </tbody>
  62.             <tfoot>
  63.                 <tr>
  64.                     <td>
  65.                         <input type="button" value="C" onclick="document.calculator.ans.value=''">
  66.                     </td>
  67.                     <td>
  68.                         <input type="button" value="0" onclick="document.calculator.ans.value+='0'">
  69.                     </td>
  70.                     <td>
  71.                         <input type="button" value="=" onclick="document.calculator.ans.value=eval(document.calculator.ans.value)">
  72.                     </td>
  73.                     <td>
  74.                         <input type="button" value="/" onclick="document.calculator.ans.value+='/'">
  75.                     </td>
  76.                 </tr>
  77.             </tfoot>
  78.         </table>
  79.     </form>
  80.     </body>
  81. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement