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="#" onclick="Fun()">asdfasdf</a>
         <asp:Label ID="lab" runat="server" ></asp:Label>
        <asp:Button ID="Button1" runat="server"   CssClass="hidden"   Text="Button" onclick="Button1_Click"
            />
    </div>
    </form>
</body>

后台:
     public void Get()
        {
            lab.Text = "天笑";
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Get();
        }

posted on 2012-07-19 15:33  成天狂  阅读(527)  评论(0编辑  收藏  举报