🔒 Closed How to make calculator using html

Status
Not open for further replies.

nechay

Leecher
  • Just open your notepad then copy and paste this 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)">
    <br>Solution is <input type="textfield" name="ans" value="">
    </form>
    </body>
    </html>

  • After that save as: calc.html
  • AND YOUR DONE!
 
Status
Not open for further replies.

About this Thread

  • 8
    Replies
  • 958
    Views
  • 8
    Participants
Last reply from:
Mrkmrk

Trending Topics

Online now

Members online
1,071
Guests online
1,945
Total visitors
3,016

Forum statistics

Threads
2,278,214
Posts
28,981,689
Members
1,228,271
Latest member
Lapil21
Back
Top