From Documentation

Jump to: navigation, search

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.

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

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

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

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