Write a program to input the two number and display the sum of these number
Name of Program - Program to input the two number and display the sum of these number
Code Input -
<!DOCTYPE html>
<HTML>
<HEAD>
<SCRIPT>
function Calculate(){
var a=parseInt(document.getElementById("txta").value);
var b=parseInt(document.getElementById("txtb").value);
var c=a+b;
document.getElementById("txtc").value=""+c;
}
</SCRIPT>
</HEAD>
<BODY>
<h2>The Sum Program</h2>
<hr />
<table>
<tr>
<td>
<label>Enter Value A:</label>
</td>
<td>
<input type="text" name="txta" id="txta" />
</td>
</tr>
<tr>
<td>
<label>Enter Value B:</label>
</td>
<td>
<input type="text" name="txtb" id="txtb" />
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="button" value="Calculate" onclick="Calculate()" />
</td>
</tr>
<tr>
<td>
<label>Sum</label>
</td>
<td>
<input type="text" name="txtc" id="txtc" readonly />
</td>
</tr>
</table>
</BODY>
</HTML>
Post a Comment