Thursday 24 February 2011

how to clear textboxes using javascript?


how to clear textboxes using javascript?



<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="WebApplication1.WebForm2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Untitled Page</title>
    <script type="text/javascript" language="javascript">
        function ClearTextboxes()
        {
            document.getElementById('TextBox1').value = '';
            document.getElementById('TextBox2').value = '';           
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            username
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
            password
            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br />
            <asp:Button ID="ClearButton" runat="server" Text="Button" CausesValidation="false" OnClientClick="ClearTextboxes();" />
        </div>
    </form>
</body>
</html>

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Powered by Blogger