3

皆さん、私は 1 つの問題に直面しました。

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 コードの機能は、一部のブラウザーで 1 つの新しいウィンドウを開くことであり、CHROME、Firfox でうまく機能します。しかし、IE8 で実行すると、いくつかのエラーが発生します。

クライアント エラー: スクリプトの処理に失敗しました。エラー 80020101 のため、操作を完了できませんでした。(エラー)

この問題の解決策はありますか? どうもありがとうございました !!!

4

1 に答える 1

1

Executions.getCurrent().sendRedirect(string, string) javadocsを使用して、サーバー側でこれを行うことができます。しかし、そのような単純な要件の場合、サーバーに移動する必要はありません。ZKのクライアント名前空間を使用すると、クライアント側のボタンonClickイベントでtestAlert()関数を呼び出すことができます。両方のアプローチを以下のコードに示します。これはIE8(標準モード)で機能します。

<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>    
于 2012-09-13T06:26:59.353 に答える