script

From Documentation
Revision as of 07:04, 5 November 2010 by Tomyeh (talk | contribs) (Created page with '{{ZUMLReferencePageHeader}} <syntax lang="xml" > <?script type="text/javascript" [src="uri"] [charset="encoding"] [content="javascript"] [if="..."] [unless="..."]?> </syntax>…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<syntax lang="xml" >

<?script type="text/javascript" [src="uri"] [charset="encoding"]
 [content="javascript"] [if="..."] [unless="..."]?> 

</syntax>

[since 3.6.2]

It specifies an element that shall be generated inside the HEAD element. It is generated after' ZK default JavaScript and CSS files. Currently only HTML-based clients (so-called browsers) support them. Furthermore, HTML SCRIPT tag is actually generated for each of this declaration.

Developers can specify whatever attributes you like; it is up to the browser to interpret. ZK only evaluates the if and unless attributes, and encodes the URI of the href and src attribute (by use of the encodeURL method of the Executions class). ZK generates all other attributes directly to the client.

Notice that these header directives are effective only for the main ZUL page. In other words, they are ignored if a page is included by another pages or servlets. Also, they are ignored if the page is a zhtml file.

<syntax lang="xml" > <?script type="text/javascript" src="/js/foo.js"?> <?script type="text/javascript" content="var foo = true; if (zk.ie) doSomething();"?>

<window title="My App">
    My content
</window>

</syntax>

Alternatives

Alternatively, you could use the script component to embed JavaScript code. The script component supports more features such as defer, but it has some memory foot print at the server (since it is a component).

Version History

Version Date Content
     



Last Update : 2010/11/05

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