标签:
在Asp.net页面中,经常会用到查询并显示结果,有很多的查询条件的文本框,那么也会用到清空按钮了,就是清空查询的条件的文本框或者别的控件。<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <table style="text-align:center;"> <tr> <td><asp:Label ID="lbl1" runat="server" Text="姓名" /></td> <td><asp:TextBox ID="txt1" runat="server" Width="100px" /></td> <td><asp:Label ID="lb12" runat="server" Text="职业" /></td> <td><asp:TextBox ID="txt2" runat="server" Width="100px" /></td> </tr> <tr> <td align="right" colspan="4"> <asp:Button ID="buttonReset1" runat="server" Text="清空一" OnClientClick="return Reset1()"/> <asp:Button ID="buttonReset2" runat="server" Text="清空二" OnClientClick="return Reset2()"/></td> </tr> </table> </div> </form> </body> <script type="text/javascript"> function Reset1() { document.getElementById("<%=txt1.ClientID%>").value = ""; document.getElementById("<%=txt2.ClientID%>").value = ""; return false; } function Reset2() { this.document.location = this.document.location; return false; } </script> </html>
标签:
原文地址:http://blog.csdn.net/yysyangyangyangshan/article/details/43344485