gpt4 book ai didi

javascript - IE 中关于 ZK 和 JavaScript 集成的一些错误

转载 作者:行者123 更新时间:2023-11-29 15:45:20 25 4
gpt4 key购买 nike

各位,我遇到了一个问题:

ZUL 代码:

<window title="Hello World!!" id="winMain" border="none" width="100%" height="100%">

<script type="text/javascript">
<![CDATA[
function testAlert() {
window.open ("http://cn.bing.com", "Show", "menubar=0,resizable=1,location=0,width=683,height=384");}
]]>
</script>

<div align="center">
<button id="btnShow" label="Show">
<attribute name="onClick">
<![CDATA[
Clients.evalJavaScript("testAlert()");
]]>
</attribute>
</button>
</div>
</window>

ZUL代码的作用是在一些浏览器中新开一个窗口,在CHROME、Firfox中运行良好。但是当我在 IE8 中运行它时,会出现一些错误:

客户端错误:无法处理脚本;由于错误 80020101,无法完成操作。(错误)

这个问题有什么解决办法吗?非常感谢!!!

最佳答案

您可以使用Executions.getCurrent().sendRedirect(string, string) javadocs在服务器端执行此操作。但是对于这样一个简单的要求,您不需要去服务器。使用 ZK 的 client namespace您可以在客户端的按钮 onClick 事件上调用 testAlert() 函数。这两种方法都显示在下面的代码中,它适用于 IE 8(标准模式)

<window title="Hello World!!" id="winMain" border="none" width="100%" height="100%" xmlns:w="client">

<script type="text/javascript">
<![CDATA[
function testAlert() {
window.open ("http://cn.bing.com", "Show", "menubar=0,resizable=1,location=0,width=683,height=384");}
]]>
</script>

<div align="center">
<button id="btnShow" label="Show 1">
<attribute name="onClick">
<![CDATA[
Executions.getCurrent().sendRedirect("http://cn.bing.com", "_blank");
]]>
</attribute>
</button>
<button id="btnShow2" label="Show 2" w:onClick="testAlert();">

</button>
</div>
</window>

关于javascript - IE 中关于 ZK 和 JavaScript 集成的一些错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12382182/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com