- <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中的那个按钮就会执行
|