JS触发服务器控件的单击事件

<script src="../Js/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#a_doClick").click(function () {
                $("#<%=btnTest.ClientID%>").click();
            })
        })
    </script>

  

<a id="a_doClick">触发Button的Click事件</a>
<asp:Button runat="server" ID="btnTest" Text="测试js触发事件" OnClick="btnTest_Click" />

  

 protected void btnTest_Click(object sender, EventArgs e)
        {
           Response.Redirect("http://www.baidu.com");
        }

 

  最主要的是<%=btnTest.ClientID%>

 

posted @ 2015-08-03 15:34  巴别塔  阅读(909)  评论(0编辑  收藏  举报