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

Posted by Arkady Kashin on Stack Overflow See other posts from Stack Overflow or by Arkady Kashin
Published on 2010-04-02T10:21:23Z Indexed on 2010/04/02 10:23 UTC
Read the original article Hit count: 505

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about zk

Related posts about JavaScript