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
What are the distinct types of error name values?
How to print a web page using javascript?
What is double exclamation point?
What is undefined value means in javascript?
What is lambda in programming?
Why javascript is fast?
Are there any predefined constant provided by the browser with the key code values that can be reused?
What are all the looping structures in javascript?
What is console.log()?
Is a relation always a function?
In a pop-up browser window, how do you refer to the main browser window that opened it?
Which built-in method combines the text of two strings and returns a new string?
How to convert a string to a number using javascript?
What is built in function in javascript?
How can a page be forced to load another page in javascript?