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


Please Help Members By Posting Answers For Below Questions

What are the distinct types of error name values?

517


How to print a web page using javascript?

501


What is double exclamation point?

512


What is undefined value means in javascript?

549


What is lambda in programming?

440






Why javascript is fast?

462


Are there any predefined constant provided by the browser with the key code values that can be reused?

490


What are all the looping structures in javascript?

471


What is console.log()?

501


Is a relation always a function?

488


In a pop-up browser window, how do you refer to the main browser window that opened it?

448


Which built-in method combines the text of two strings and returns a new string?

667


How to convert a string to a number using javascript?

488


What is built in function in javascript?

491


How can a page be forced to load another page in javascript?

638