+4

# HTML calculator

How do you make a calculator

9/10/2018 9:36:57 PM

Gamercool

+2

HTML can't do computations of any kind, so that isn't possible. you can use JS instead

+2

well then how do i code a calculater on javascript

+2

Gamercool, In additional to hinanawi's answer: You can calculate values with eval() This is one of many ways to create a calculator with javascript to calculate values. Here is an example source that takes user input and calculate them with eval() Hope it helps👍 https://code.sololearn.com/W3O41HSTCa4H/?ref=app

+2

Making calculator with JavaScript is very easy You can take guidance form this -- https://code.sololearn.com/W2J8H89mUb07/?ref=app

+1

example JS calculator: var txt = 1; var txt2 = 6; document.write(txt+txt2) Html is possible! <form name="Val"> <input type="text" name="result"> <br /> <br /> <input type="button" value="1" onclick="document.Val.result.value+=1"> <input type="button" value="2" onclick="document.Val.result.value+=2"> <input type="button" value="3" onclick="document.Val.result.value+=3"> <input type="button" value="4" onclick="document.Val.result.value+=4"> <br /><br /> <input type="button" value="5" onclick="document.Val.result.value+=5"> <input type="button" value="6" onclick="document.Val.result.value+=6"> <input type="button" value="7" onclick="document.Val.result.value+=7"> <input type="button" value="8" onclick="document.Val.result.value+=8"> <input type="button" value="9" onclick="document.Val.result.value+=9"> <input type="button" value="0" onclick="document.Val.result.value+=0"> <input type="button" value="." onclick="document.Val.result.value+='.'" style="font-size:20px"> <input id="c" type="button" value="C" onclick="document.Val.result.value=''"> <br /><br /> <input id="s" type="button" value="+" onclick="document.Val.result.value+='+'"> <input id="s" type="button" value="-" onclick="document.Val.result.value+='-'"> <input id="s" type="button" value="*" onclick="document.Val.result.value+='*'"> <input id="s" type="button" value="/" onclick="document.Val.result.value+='/'"> <br /><br /> <input id="tt" type="button" value="=" onclick="document.Val.result.value=eval(document.Val.result.value)"> </form>

+1

This is one of the most simplest and easiest https://code.sololearn.com/WthMdFqtDMfy/?ref=app

+1

Gamercool brother, You can make Age calculator(birth calculator) by html. https://code.sololearn.com/WgVWdueBMT8B/?ref=app You can calculate your age by this calculator.. (If it is correct answer of your question, you upvote my answer & mark as a best answer😃) Thank you