js里面调用后台的方法
<style type="text/css">
.hidden { display:none; //注意,此处隐藏按钮,必须用diaplay不能用Visibiy } </style> <script type="text/javascript"> function Fun() { document.getElementById("Button1").click();}
</script></head><body> <form id="form1" runat="server"> <div> <a href="#" οnclick="Fun()">asdfasdf</a> <asp:Label ID="lab" runat="server" ></asp:Label> <asp:Button ID="Button1" runat="server" CssClass="hidden" Text="Button" οnclick="Button1_Click" /> </div> </form></body>后台:
public void Get() { lab.Text = "天笑"; }protected void Button1_Click(object sender, EventArgs e)
{ Get(); }