FineUI 官方论坛
标题:
ExtAspNet 如何调用 JS
[打印本页]
作者:
六脉神剑
时间:
2012-11-26 12:57
标题:
ExtAspNet 如何调用 JS
<form id="form1" runat="server">
<script type="text/javascript">
function ss() {
confirm("底层调用js,调用成功!");
}
</script>
<asp:Button ID="Button1" runat="server" Text="底层调用js" onclick="Button1_Click" />
</form>
protected void Button1_Click(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(ClientScript.GetType(), "gg", "<script>ss(); </script>");
}
复制代码
在上面的测试页面中,点击按钮能够正常执行
但是在ExtAspNet的页面中就不被执行
<form id="form1" runat="server">
<script type="text/javascript">
function ss() {
confirm("底层调用js,调用成功!");
}
</script>
<ext:PageManager ID="PageManager1" runat="server" EnableAjax="true" />
<ext:Panel ID="formPanel" ShowBorder="false" ShowHeader="false" Layout="Fit" BodyPadding="5px"
EnableBackgroundColor="true" runat="server" EnableAjax="true">
<Toolbars>
<ext:Toolbar ID="Toolbar1" runat="server" Position="Bottom">
<Items>
<ext:Button ID="btnJS" runat="server" Text="调用JS" OnClick="btnJS_Click" EnableAjax="true"></ext:Button>
<ext:ContentPanel runat="server"><input type="button" value="12345" onclick="ss();" /></ext:ContentPanel>
</Items>
</ext:Toolbar>
</Toolbars>
</ext:Panel>
</form>
protected void btnJS_Click(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(ClientScript.GetType(), "gg", "<script>ss(); </script>");
}
复制代码
在上面的代码中,点击了btnJS并没有调用js,但是点击了ContentPanel中的那个按钮就会执行
欢迎光临 FineUI 官方论坛 (https://fineui.com/BBS/)
Powered by Discuz! X3.4