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
Describe what u had done today?
What is an immediately-invoked function expression?
What is the use of a weakmap object in javascript?
What javascript method would convert the string “20” to an integer (on the fly) so “20” + 20 = 40?
Are there any training Institutions on iphone Automation testing?
Which company developed JavaScript?
What is the use of let & const in javascript?
Is it safe to use javascript?
Can I open javascript on iphone?
What are undefined and undeclared variables?
What is difference between local and global scope in javascript ?
Can you run javascript in notepad?
How can a Javascript code redirect the user to a different page?
What is decodeuri() function?
Should you disable javascript?