ZK: Problem with JavaScript method invoking from action in Google Chrome
- by Arkady Kashin
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.