HTML
CSS
JAVASCRIPT
BOOTTRICK
LATEST BLOG
CODE SHARE
JSON VIEWER
LATEST JOBS
Online Training
Calculator using javascript
User
HTML
<html> <title>Agyanadda calculator</title> <head> </head> <body> <br><br><br><br> <form name="cal"> <table border="1" align="center"> <tr> <td colspan="4"> <input type="text" name="display" id="display" disabled placeholder="0"> </td> </tr> <tr> <td><input type="button" name="one" value="1" onclick="cal.display.value += '1'"></td> <td><input type="button" name="two" value="2" onclick="cal.display.value += '2'"></td> <td><input type="button" name="three" value="3" onclick="cal.display.value += '3'"></td> <td><input type="button" class="o perator" name="plus" value="+" onclick="cal.display.value += '+'"></td> </tr> <tr> <td><input type="button" name="four" value="4" onclick="cal.display.value += '4'"></td> <td><input type="button" name="five" value="5" onclick="cal.display.value += '5'"></td> <td><input type="button" name="six" value="6" onclick="cal.display.value += '6'"></td> <td><input type="button" class="operator" name="minus" value="-" onclick="cal.display.value += '-'"></td> </tr> <tr> <td><input type="button" name="seven" value="7" onclick="cal.display.value += '7'"></td> <td><input type="button" name="eight" value="8" onclick="cal.display.value += '8'"></td> <td><input type="button" name="nine" value="9" onclick="cal.display.value += '9'"></td> <td><input type="button" class="operator" name="times" value="x" onclick="cal.display.value += '*'"></td> </tr> <tr> <td><input type="button" id="clear" name="clear" value="c" onclick="cal.display.value = ''"></td> <td><input type="button" name="zero" value="0" onclick="cal.display.value += '0'"></td> <td><input type="button" name="doit" value="=" onclick="cal.display.value = eval(cal.display.value)"></td> <td><input type="button" class="operator" name="div" value="/" onclick="cal.display.value += '/'"></td> </tr> </table> </form> </body> </html>
CSS
input[type="button"]{width:100%;padding:10px;1px}
JavaScript