JavaScript | Calculator (literally...)

/ 10 Aug 2013 /
This took me so long, only because I didn't want to copy and paste so I could remember it, well now I do, worth it? YES am I ever going to use it? lol no



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<form name ='Calc'>
  <table border=4>
    <tr>
      <td>
        <input type='text' Name='Input' size='16'>
        <br>
      </td>
    </tr>
    <tr>
      <td>
        <input type='button' name='one' value=' 1 ' onClick="Calc.Input.value += '1'">
        <input type='button' name='two' value=' 2 ' onClick="Calc.Input.value += '2'">
        <input type='button' name='three' value=' 3 ' onClick="Calc.Input.value += '3'">
        <input type='button' name='add' value='  +  ' onClick="Calc.Input.value += ' + '">
        <br>
        <input type='button' value=' 4 ' name='four' onClick="Calc.Input.value +='4'">
        <input type='button' name='five' value=' 5 ' onClick="Calc.Input.value +='5'">
        <input type='button' value=' 6 ' name='six' onClick="Calc.Input.value +='6'">
        <input type='button' value='  -   ' name='minus' onclick="Calc.Input.value +=' - '">
        <br>
        <input type='button' value=' 7 ' name='seven' onClick="Calc.Input.value +='7'">
        <input type='button' value=' 8 ' name='eight' onClick='Calc.Input.value +="8"'>
        <input type='button' value=' 9 ' name='nine' onClick="Calc.Input.value +='9'">
        <input type='button' value='  x  ' name='times' onClick="Calc.Input.value +=' * '">
        <br>
        <input type='button' value=' c ' name='clear' onClick="Calc.Input.value = ''">
        <input type='button' value=' 0 ' name='zero' onClick="Calc.Input.value +='0'">
        <input type='button' value=' = ' name='ans' onClick="Calc.Input.value = eval(Calc.Input.value)">
        <input type='button' value='  /  ' name='div' onClick="Calc.Input.value += ' / '">
        


How it looks:




 
Copyright © 2010 M(ath)+me, All rights reserved