Write a complete webpage with embedded JavaScript code that

Write a complete webpage with embedded JavaScript code that Create a GUI as shown below. The GUI is made of three label \"Number1\", \"Number2\", and \"Sum\", three textboxes (top two for input, and bottom one for output), and one \"Calculate\" button. Write the handler function for the onclick event of the button that adds the value of top two input textboxes and then shows the sum in the third lower textbox.

Solution

Answer :-

<html>
<body>
<p>Click the button to calculate First Number and Second Number.</p>
<button onclick=\"calculateFunction()\">Try it</button>
<br/>
<br/>
Enter first number:
<input type=\"text\" id=\"txtfno1\" name=\"text1\">
Enter second number:
<input type=\"text\" id=\"txtlno2\" name=\"text2\">
<p id=\"Result\"></p>
<script>
function calculateFunction() {
var FirstNumber = document.getElementById(\"txtfno1\").value;
var Secondnumber = document.getElementById(\"txtlno2\").value;
var calculateResult = FirstNumber + Secondnumber;
document.getElementById(\"Result\").innerHTML = calculateResult;
}
</script>
</body>
</html>

 Write a complete webpage with embedded JavaScript code that Create a GUI as shown below. The GUI is made of three label \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site