如:
<asp:TextBox ID="txtSubject" runat="server">aa</asp:TextBox>
第一次用服务器控件,原来他就是和input标签一样 !
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <script type="text/javascript" src="script/Jquery.js"></script> <script type="text/javascript"> $(function () { var str=""; var t1=document.getElementById("<%= TextBox1.ClientID").value; var t2=$("#<%= TextBox1.ClientID%>").val(); alert(t1); alert(t2); }) </script> </head> <body> <form id="form1" runat="server"> <asp:TextBox ID="TextBox1" runat="server">sdf</asp:TextBox> <asp:TextBox ID="TextBox2" runat="server">sdf</asp:TextBox> <asp:TextBox ID="TextBox3" runat="server">ee</asp:TextBox> <asp:TextBox ID="TextBox4" runat="server">ee</asp:TextBox> <asp:TextBox ID="TextBox5" runat="server">ee</asp:TextBox> <input type="button" name="button" value="button"/> </form> </body> </html>
时间: 2024-10-02 04:17:28