+ -
当前位置:首页 → 问答吧 → 急:Js 如何触发updatepanel 里面的按钮click事件

急:Js 如何触发updatepanel 里面的按钮click事件

时间:2011-10-31

来源:互联网

HTML code
说明:button1 按钮 能够触发 服务器控件 btn事件
而 button2 按钮却不能触发 为什么?如何解决
 
<input type="button" id="button1" onclick="func_Click()" />
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
     <ContentTemplate>
        <input type="button" id="button2" onclick="func_Click()" />
     </ContentTemplate>
</asp:UpdatePanel>

<asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Conditional" runat="server">
     <ContentTemplate>
      <asp:Button ID="btn"  OnClick="btn_Click" />
     </ContentTemplate>
</asp:UpdatePanel>

<script>
function func_Click()
{
document.getElementById('<%= btn.ClientID%>').click();
}
</script>

作者: msy_nj   发布时间: 2011-10-31

顶下 : 求解、求解。。。

作者: msy_nj   发布时间: 2011-10-31

template里面控件生成的html标签的id会加上父容器的前缀
用class吧

作者: KK3K2005   发布时间: 2011-10-31

热门下载

更多