Thursday 23 January 2014

pass textbox value into a javascript function using asp.net c#

Read our previous articles  check-postback-in-asp.net and how-to-disable-back-button-in-browser
<html xmlns="http://www.w3.org/1999/xhtml" >

<head id="Head1" runat="server">

    <title>Untitled Page</title>

<script type="text/javascript">
function function1()
{
var a=document.forms[0]["TextBox1"].value;
alert(a); 
}
</script>

</head>

<body>

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

    <div>

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

         

        <asp:Button ID="pass1" runat="server" OnClientClick="function1()"  Text="pass calue"

           />

    </div>

    </form>

</body>

</html>

check and view result ...

0 comments:

Post a Comment