Script"
Line 14: | Line 14: | ||
[[Image:ZKComRef_Script_Example.png ]] | [[Image:ZKComRef_Script_Example.png ]] | ||
− | < | + | <syntaxlang="xml" > |
<zk> | <zk> | ||
<window id="win"> | <window id="win"> | ||
Line 25: | Line 25: | ||
</script> | </script> | ||
</zk> | </zk> | ||
− | </ | + | </syntax> |
=Defer the evaluation= | =Defer the evaluation= |
Revision as of 02:23, 15 September 2010
Script
Employment/Purpose
The script component is used to specify the script codes running at the browser. Notice that, unlike zscript, the script codes are running at the browser. They are usually written in JavaScript which is supported by the most of browsers. The simplest format is as follows.
Example
<syntaxlang="xml" >
<zk>
<window id="win"> <button label="change color" onClick='Clients.evalJavaScript("myfunc()")' /> </window> <script type="text/javascript"> function myfunc() { jq("$win").css("backgroundColor", "blue"); }
</script>
</zk> </syntax>
Defer the evaluation
By default, the specified JavaScript code will be evaluated as soon as the page is loaded. There is an option called defer. By specifying true, the JavaScript code won't be evaluated until all widgets are created and bound to the DOM tree.
<syntax lang="javascript"> <textbox id="inp"/> <script defer="true">
this.$f("inp").setValue("initialized");
</script> </syntax>
Supported events
None | None |
Supported Children
*NONE
Use cases
Version | Description | Example Location |
---|---|---|
Version History
Version | Date | Content |
---|---|---|