Here is the asp.net web form:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 id="first">Enter 1st Number<input type="text" /></h2>
<h2 id ="second">Enter 2nd Number<input type="text" /></h2>
<h2 id="third">Enter 3rd Number<input type="text" /></h2>
<button onclick="test()">Sublit</button>
</div>
<p id="sum"></p>
</form>
<script src="JavaScript.js"></script>
And this is the javascript file:
function test()
{
var num1 = parseInt(document.getElementById("first").value)
var num2 = parseInt(document.getElementById("second").value)
var num3 = parseInt(document.getElementById("third").value)
var z = num1 + num2 + num3
document.getElementById("sum").innerHTML = z
}
When I am pressing submit button sum of three no is not showing in page. It showws NAN once and after that it disappears. I started learning .net. Help me plz