Basic HTML Calculator



              


HTML Calculator

Html is a web design language. Today I'm going to Teach you How to create a Simple Calculator Using Html Language.

How to do it? 

1) Open a text editing program on your computer


HTML Calculator



2) Paste the HTML code  into the document


HTML Calculator




Copy the code below


<html>


<head>


<title>HTML Calculator</title>


</head>


<body bgcolor= "#000000" text= "gold">


<form name="calculator" >


<input type="button" value="1" onClick="document.calculator.ans.value+='1'">


<input type="button" value="2" onClick="document.calculator.ans.value+='2'">


<input type="button" value="3" onClick="document.calculator.ans.value+='3'">


<input type="button" value="4" onClick="document.calculator.ans.value+='4'">


<input type="button" value="5" onClick="document.calculator.ans.value+='5'">


<input type="button" value="6" onClick="document.calculator.ans.value+='6'">


<input type="button" value="7" onClick="document.calculator.ans.value+='7'">


<input type="button" value="8" onClick="document.calculator.ans.value+='8'">


<input type="button" value="9" onClick="document.calculator.ans.value+='9'">


<input type="button" value="-" onClick="document.calculator.ans.value+='-'">


<input type="button" value="+" onClick="document.calculator.ans.value+='+'">


<input type="button" value="*" onClick="document.calculator.ans.value+='*'">


<input type="button" value="/" onClick="document.calculator.ans.value+='/'">




<input type="button" value="0" onClick="document.calculator.ans.value+='0'">


<input type="reset" value="Reset">


<input type="button" value="=" onClick="document.calculator.ans.value=eval(document.calculator.ans.value)">


<br>Solution is <input type="textfield" name="ans" value="">


</form>


</body>


</html>



3) Go to the files and Select Save As option






4) Add an HTML extension to the file name. In the "SaveAs..." menu, type in your file  name followed by ".html", and then click "Save". For example, if you wanted to call this file "cal", you would save the file as "Cal.html"






5) Now open your file



    Result






                                       If you Like this article Don't Forget To share 








Post a Comment

[blogger]

MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget