The Scripting Codes in a Separate File

From Documentation
Revision as of 04:09, 15 July 2010 by Maya001122 (talk | contribs) (Created page with '{{ZKDevelopersGuidePageHeader}} To separate codes and views, developers could put the scripting codes in a separated file, say sayHello.zs, and then use the src attribute to ref…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
The Scripting Codes in a Separate File


Stop.png This documentation is for an older version of ZK. For the latest one, please click here.


To separate codes and views, developers could put the scripting codes in a separated file, say sayHello.zs, and then use the src attribute to reference it.

<window>
    <button label="Say Hello" onClick="sayHello()"/>    
    <zscript src="sayHello.zs"/>    
</window>

which assumes the content of sayHello.zs is as follows.

int count = 0;
void sayHello() { //declare a global function
    alert("Hello World! "+ ++count);    
}



Last Update : 2010/07/15

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.