script
element. The script can be either an external script of an embdeed script. Note that you can define as many scripts as you need. For example: <window id="Test" title="Test XULScripts" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> function clicked() { alert('button clicked()'); } </script> <script type="text/javascript" src="myScript.js" /> ... </window>
window
element which is the root of the XUL file.menubar
element<window id="Test" title="My Window" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <toolbox> <toolbar id="nav-toolbar"> <toolbarbutton id="nav-users" label="Users"/> <toolbarbutton id="nav-groups" label="Groups"/> <toolbarbutton id="nav-events" label="Events" disabled="true"/> </toolbar> </toolbox> </window>
<menubar> <menu label="Colors"> <menupopup> <menuitem label="Red"/> <menuitem label="Blue"/> <menuitem label="Yellow"/> </menupopup> </menu> </menubar>
<window title="Example 3...." width="400" height="200" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> function checked() { document.getElementById('spacer').height = 30; } </script> <script src="myScript.js" /> <toolbox> <toolbar> <toolbarbutton id="nav-users" label="Users"/> <toolbarbutton id="nav-events" label="Events"/> </toolbar> </toolbox> <menubar> <menu label="File"> <menupopup> <menuitem label="Open"/> <menuitem label="Save"/> <menuitem label="Exit"/> </menupopup> </menu> </menubar> <vbox> <button label="button1" oncommand="checked()" /> <spacer id="spacer" height="10px" /> <button label="button2" /> </vbox> </window>The result will be:
Copyright 2008-2020 Herve Girod. All Rights Reserved. Documentation and source under the LGPL licence