Friday, February 3, 2017

HTML CODE TO CREATE A SIMPLE CALCULATOR

                                            / *PROGRAM BY LAXMAN POUDEL/*
<html>
<head>
<title>HTML CALCULATOR</title>
<p> HTML CALCULATOR BY LAXMAN POUDEL</p>
</head>
<table border="10" width="15">
<body bgcolor= "#000000" text= "gold">
<form name="calculator" >
<tr>
<td><input type="button" value="1" onClick="document.calculator.ans.value+='1'"></td>
<td><input type="button" value="2" onClick="document.calculator.ans.value+='2'"></td>
<td><input type="button" value="3" onClick="document.calculator.ans.value+='3'"></td></tr>
 <input type  ="button" value="+"     onClick="document.calculator.ans.value+='+'">

<tr>
<td><input type="button" value="4" onClick="document.calculator.ans.value+='4'"></td>
<td><input type="button" value="5" onClick="document.calculator.ans.value+='5'"></td>
<td><input type="button" value="6" onClick="document.calculator.ans.value+='6'"></td></tr>
<input type="button" value="-" onClick="document.calculator.ans.value+='-'">

<tr>
<td><input type="button" value="7" onClick="document.calculator.ans.value+='7'">
<td><input type="button" value="8" onClick="document.calculator.ans.value+='8'"></td>
<td><input type="button" value="9" onClick="document.calculator.ans.value+='9'"></td>
<input type="button" value="*" onClick="document.calculator.ans.value+='*'"></td>
<input type="button" value="/" onClick="document.calculator.ans.value+='/'"></tr>

<input type="button" value="0" onClick="document.calculator.ans.value+='0'">
<input type="reset" value="Reset"></td>
<input type="button" value="=" onClick="document.calculator.ans.value=eval(document.calculator.ans.value)">
<br>Calculation Is <input type="textfield" name="ans" value=""></tr>

</form>
</table>
</body>    
</html>                                            OUTPUT WINDOW     



WATCH FULL TUTORIAL TO KNOW HOW TO CREATE HTML CALCULATOR

No comments:

Post a Comment