日期:2014-05-18 浏览次数:20498 次
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <style type="text/css"> .dis {display:none;} </style> <script language="javascript" type="text/javascript"> function Sub() { debugger; document.getElementById("<%=Button1.ClientID %>").click(); } </script> </head> <body> <form id="form1" runat="server"> <div> <a href="javascript:Sub();" target="_parent">S2</a> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" CssClass="dis"/> </div> </form> </body> </html>
------解决方案--------------------
document.getElementById("<%=Button1.ClientID %>").click();
这个等效于__doPostBack("<%=Button1.ClientID %>",null);
------解决方案--------------------