Write a javascript program to make a simple calculator
Answer Posted / san
<html>
<form name="cals">
<table border=1>
<tr>
<td>
<input type="text" name="text" size=15>
</td>
</tr>
<br>
<tr>
<td>
<input type="button" value="1" onclick="cals.text.value +='1'">
<input type="button" value="2" onclick="cals.text.value +='2'">
<input type="button" value="3" onclick="cals.text.value +='3'">
<input type="button" value="+" onclick="cals.text.value +='+'">
<br>
<input type="button" value="4" onclick="cals.text.value +='4'">
<input type="button" value="5" onclick="cals.text.value +='5'">
<input type="button" value="6" onclick="cals.text.value +='6'">
<input type="button" value="- " onclick="cals.text.value +='-'">
<br>
<input type="button" value="7" onclick="cals.text.value +='7'">
<input type="button" value="8" onclick="cals.text.value +='8'">
<input type="button" value="9" onclick="cals.text.value +='9'">
<input type="button" value="*" onclick="cals.text.value +='*'">
<br>
<input type="button" value="c" onclick="cals.text.value =''">
<input type="button" value="0" onclick="cals.text.value +='0'">
<input type="button" value="=" onclick="cals.text.value = eval(cals.text.value)">
<input type="button" value="/" onclick="cals.text.value +=' /'">
<br>
</td>
</tr>
</table>
</form>
</html>
| Is This Answer Correct ? | 11 Yes | 7 No |
Post New Answer View All Answers
Which built-in method returns the calling string value converted to upper case?
What is the difference between the keywords var and let?
List some of the advantages of javascript.
Does javascript support automatic type conversion, if yes give example.
How to get the primitive value of a string in Javascript?
What is javascript used for in web design?
What is difference between javascript and jscript?
What is an empty html tag?
How do I view javascript files in chrome?
TypeError: document.getelementbyid(...) is null?
Taking a developer's perspective, do you think that that javascript is easy to learn and use?
How do you define a class and its constructor?
What are decodeuri() and encodeuri() functions in javascript?
How to access the value of a textbox using javascript?
What is the most popular javascript library?