Blog

Client Side Addition

Aug 20, 2013 Blogs | JavaScript
Javascript using addition.

The below code use to add twoo number by the using of JavaScript only.

<script language="javascript" type="text/javascript"

    function Navigate() {       

        var x = document.getElementById("txt1").value;

        var y = document.getElementById("txt2").value;

        var z =parseInt( x )+parseInt( y);

        document.getElementById("txt3").value = z;

    }

</script>

<body>

    <form id="form1" runat="server">

    <div>

        <%-- <asp button type="button" onclick="alert('Welcome!')">Click Me!</button>--%>

        <asp:Button ID="Button1" UseSubmitBehavior="true" Text="Open Web site" OnClientClick="Navigate()"

            runat="server" />

        <asp:TextBox ID="txt1" runat="server"></asp:TextBox>

        <asp:TextBox ID="txt2" runat="server"></asp:TextBox>

        <asp:TextBox ID="txt3" runat="server"></asp:TextBox>

    </div>

    </form>

  • 388rank
  • 45K readers
COMMENT USING

PREMIUM SPONSORS

Hire Mobile & Web Developer on demand. 100% satisfaction. Try for 1 week or Money Back. Local and remote developers available all over USA.

Latest Blogs