HTML calculator | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

HTML calculator

How do you make a calculator

10th Sep 2018, 9:36 PM
Gamercool
Gamercool - avatar
7 Answers
+ 2
HTML can't do computations of any kind, so that isn't possible. you can use JS instead
10th Sep 2018, 9:41 PM
hinanawi
hinanawi - avatar
+ 2
well then how do i code a calculater on javascript
10th Sep 2018, 9:42 PM
Gamercool
Gamercool - avatar
+ 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
10th Sep 2018, 9:48 PM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar
+ 2
Making calculator with JavaScript is very easy You can take guidance form this -- https://code.sololearn.com/W2J8H89mUb07/?ref=app
2nd Jan 2019, 1:54 PM
Mrityunjay
Mrityunjay - avatar
+ 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>
11th Sep 2018, 2:34 AM
Potato Hacker
Potato Hacker - avatar
+ 1
This is one of the most simplest and easiest https://code.sololearn.com/WthMdFqtDMfy/?ref=app
11th Sep 2018, 8:08 AM
Yash
Yash - avatar
+ 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
19th Apr 2021, 6:12 AM
Md. Rafeul Azad Rafe