Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Roger123

[Tip]HTML Calculator

Recommended Posts




HTML Calculator



With this tutorial, we will learn how to create an HTML calculator.


--> Programming - Questions
HTML Calculator




1 - Code
Simply put in an HTML page the following code:
Code:
<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="+" onClick="document.calculator.ans.value+='+'"><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="-" onClick="document.calculator.ans.value+='-'"><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="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)">Solution is <input type="textfield" name="ans" value=""></form></body></html>



2 - Result
Here's the result: https://www.all-themes.net/h5-calculator




©️ All Themes




If you have any questions regarding this topic, please create a topic with the following title: [Question] -
HTML Calculator
  • Like 1

Share this post


Link to post
Share on other sites

×
×
  • Create New...