Learn to Make a Simple CALCULATOR in just 2 minutes with HTML without using JavaScript or CSS.
(2 minutes coding)
<head>
<title>HTML Calculator</title>
</head>
<body alignment="center" bgcolor= "black" text= "RED">
<H1 >CALCULATOR</H1>
<form name="calculator" >
<input type="button" value="1" onClick="document.calculator.display.value+='1'">
<input type="button" value="2" onClick="document.calculator.display.value+='2'">
<input type="button" value="3" onClick="document.calculator.display.value+='3'">
<br>
<input type="button" value="4" onClick="document.calculator.display.value+='4'">
<input type="button" value="5" onClick="document.calculator.display.value+='5'">
<input type="button" value="6" onClick="document.calculator.display.value+='6'">
<br>
<input type="button" value="7" onClick="document.calculator.display.value+='7'">
<input type="button" value="8" onClick="document.calculator.display.value+='8'">
<input type="button" value="9" onClick="document.calculator.display.value+='9'">
<br>
<input type="button" value="0" onClick="document.calculator.display.value+='0'">
<input type="button" value="-" onClick="document.calculator.display.value+='-'">
<input type="button" value="+" onClick="document.calculator.display.value+='+'">
<br>
<input type="button" value="*" onClick="document.calculator.display.value+='*'">
<input type="button" value="/" onClick="document.calculator.display.value+='/'">
<input type="button" value="=" onClick="document.calculator.display.value=eval(document.
calculator.display.value)">
<br>
<input type="reset" value="Reset">
Result <input type="textfield" name="display" value="">
</form>
</body>
</html>
3. Now paste it in your Notepad file.
3. Now save your file with .html extension.
(2 minutes coding)
Steps to make your own calculator
1. Open NOTEPAD or NOTEPAD++ in your computer .
2. Copy the code given below .
<html><head>
<title>HTML Calculator</title>
</head>
<body alignment="center" bgcolor= "black" text= "RED">
<H1 >CALCULATOR</H1>
<form name="calculator" >
<input type="button" value="1" onClick="document.calculator.display.value+='1'">
<input type="button" value="2" onClick="document.calculator.display.value+='2'">
<input type="button" value="3" onClick="document.calculator.display.value+='3'">
<br>
<input type="button" value="4" onClick="document.calculator.display.value+='4'">
<input type="button" value="5" onClick="document.calculator.display.value+='5'">
<input type="button" value="6" onClick="document.calculator.display.value+='6'">
<br>
<input type="button" value="7" onClick="document.calculator.display.value+='7'">
<input type="button" value="8" onClick="document.calculator.display.value+='8'">
<input type="button" value="9" onClick="document.calculator.display.value+='9'">
<br>
<input type="button" value="0" onClick="document.calculator.display.value+='0'">
<input type="button" value="-" onClick="document.calculator.display.value+='-'">
<input type="button" value="+" onClick="document.calculator.display.value+='+'">
<br>
<input type="button" value="*" onClick="document.calculator.display.value+='*'">
<input type="button" value="/" onClick="document.calculator.display.value+='/'">
<input type="button" value="=" onClick="document.calculator.display.value=eval(document.
calculator.display.value)">
<br>
<input type="reset" value="Reset">
Result <input type="textfield" name="display" value="">
</form>
</body>
</html>
3. Now paste it in your Notepad file.
4. File will appear like this.
5. Now open the file in any browser except internet explorer.
Wow very nice.
ReplyDeleteThank you
DeleteIts awesome..
ReplyDeleteGreat
ReplyDeleteCode is working thanks
ReplyDeleteit is really working
ReplyDeletethanks for the code
I read this article. I think You put a great deal of exertion to make this article. I like your work. inches to feet
ReplyDeletethank you
DeleteMight be identified dissertation website using the web novels experience plainly mentioned on the web-site. java developer
ReplyDeleteUnfortunately, the onclick attribute holds JavaScript, even it is not declared in a separate script tag...
ReplyDeleteNice solution, though
thnk you
DeleteVery simple way to create a calculator
ReplyDeleteGood job
Very good
ReplyDeleteI hv also used this code for creating calculator
Amazing
ReplyDelete