ZK: Problem with JavaScript method invoking from action in Google Chrome

I have a zul file with description of simple window, which contains button with action :

<?xml version="1.0" encoding="UTF-8"?>
<zk xmlns:html="http://www.w3.org/1999/xhtml"
    xmlns="http://www.zkoss.org/2005/zul"
    xmlns:zk="http://www.zkoss.org/2005/zk"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">

    <window title="My First Window" border="normal" width="200px">
    <button label="click me" action="onclick:initObj()" />
      <script type="text/javascript" defer="true">
                 function initObj() {
                    alert('initObj invoked');
                    zkJScriptObject.init();
                }
                zkJScriptObject = {
                   init: function () {
                     alert('init invoked');
                    }
                };
      </script>
    </window>
</zk>

Clicking on the button successfully invokes Javascript function initObj() and shows alerts in FireFox and in IE, but in Google Chrome causes error "Uncaught ReferenceError: initObj is not defined". Do you have any suggestions, what is the reason of that problem in Google Chrome and how can I fix it?

P.S. I'm using ZK 3.6.3.

PPS. Specified zul description renders into that html code:

<div id="zkau_798" z.type="zul.wnd2.Wnd2" z.autoz="true" class="z-window-embedded" style="width:200px;"
     z.zcls="z-window-embedded" z.minheight="100" z.minwidth="200">
    <div class="z-window-embedded-tl">
        <div class="z-window-embedded-tr"></div>
    </div>
    <div class="z-window-embedded-hl">
        <div class="z-window-embedded-hr">
            <div class="z-window-embedded-hm">
                <div id="zkau_798!caption" class="z-window-embedded-header">My First Window</div>
            </div>
        </div>
    </div>
    <div id="zkau_798!cave" class=" z-window-embedded-cnt">
    <span z.type="zul.btn.Button" id="zkau_799" class="z-button" z.zcls="z-button">
        <table id="zkau_799!box"
                  cellspacing="0"
                  cellpadding="0" border="0"
                  class="z-button"
                  onclick="initObj()"
                  style="-webkit-user-select: none; ">
        <tbody>
            <tr>
                <td class="z-button-tl">
                    <button id="zkau_799!real" class="z-button"></button>
                </td>
                <td class="z-button-tm"></td>
                <td class="z-button-tr"></td>
            </tr>
            <tr>
                <td class="z-button-cl"></td>
                <td class="z-button-cm">click me</td>
                <td class="z-button-cr">
                    <div></div>
                </td>
            </tr>
            <tr>
                <td class="z-button-bl"></td>
                <td class="z-button-bm"></td>
                <td class="z-button-br"></td>
            </tr>
        </tbody>
    </table>
    </span>
        <script id="zkau_800" type="text/javascript" defer="defer">
            function initObj() {
                alert('initObj invoked');
                zkJScriptObject.init();
            }
            zkJScriptObject = {
                init: function () {
                    alert('init invoked');
                }
            };
        </script>
    </div>
</div>

Answers


This answer will give you some highlights on use of defer:

Defer Attribute (Chrome): What do defer and async mean?


Need Your Help

Drawbacks of WebFormsMVP?

asp.net asp.net-mvc

While ASP.NET MVC seems to be a viable technology praised by a lot of developers, I can't seem to find enough reasons to devote my energy and time for it. The main reason is that I don't find enoug...

need help understanding Apache Commons Math BracketFinder

math optimization numerical-methods numerical-analysis apache-commons-math

I will start off by saying that this feels like it should be easy... but it's not entirely obvious to me. I am trying to use the BrentOptimizer to find local minima and maxima of a function. I ha...