Calculator HTML

Calculate coding

<html>
<head>
<body>
<form name="calculator">
<table>
<tr>
<td colspan="4">
<input disabled="" id="display" name="display" type="text" />
</td>
</tr>
<tr>
<td><input name="one" onclick="calculator.display.value += '1'" type="button" value="1" /></td>
<td><input name="two" onclick="calculator.display.value +='2'" type="button" value="2" /></td>
<td><input name="three" onclick="calculator.display.value +='3'" type="button" value="3" /></td>
<td><input class="operator" name="plus" onclick="calculator.display.value +='+'" type="button" value="+" /></td>
</tr>
<tr>
<td><input name="four" onclick="calculator.display.value += '4'" type="button" value="4" /></td>
<td><input name="five" onclick="calculator.display.value +='5'" type="button" value="5" /></td>
<td><input name="six" onclick="calculator.display.value +='6'" type="button" value="6" /></td>
<td><input class="operator" name="minus" onclick="calculator.display.value +='-'" type="button" value="-" /></td>
</tr>
<tr>
<td><input name="seven" onclick="calculator.display.value += '7'" type="button" value="7" /></td>
<td><input name="eight" onclick="calculator.display.value +='8'" type="button" value="8" /></td>
<td><input name="nine" onclick="calculator.display.value +='9'" type="button" value="9" /></td>
<td><input class="operator" name="times" onclick="calculator.display.value +='*'" type="button" value="*" /></td>
</tr>
<tr>
<td><input id="clear" name="clear" onclick="calculator.display.value =''" type="button" value="c" /></td>
<td><input name="zero" onclick="calculator.display.value +='0'" type="button" value="0" /></td>
<td><input name="doit" onclick="calculator.display.value=eval(calculator.display.value)" type="button" value="=" /></td>
<td><input class="operator" name="div" onclick="calculator.display.value +='/'" type="button" value="/" /></td>
</tr>
</table>
</form>
</body>
</head>
</html>

Calculate Output


Comments

Popular posts from this blog

How to create Registration form using HTML ?

Factorial HTML