getCurrentDocument()
method which can used through the helper, it is possible in javascript to use a much more "Javascripty" way to work on the document by simply working with the document
objet. It is then possible to access any widgets with IDs on the document and read or modify their properties. For example:<window id="Hello" title="Hello" orient="horizontal" width="250" height="100" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> function clicked(){ document.getElementById("theLabel").value = "NewText"; } </script> <button label="Push Me!" oncommand="clicked()" /> <label id="theLabel" label="TheText" /> </window>
importClass(java.util.List); function computeSize(list) { return list.size(); }
importPackage(java.util); function computeSize(list) { return list.size(); }
print
built-in function will call the echo
method of the XUL ScriptContext.function clicked(){ print("You clicked the button"); }
alert
built-in function will show a Popup with the alert message.function clicked(){ alert("You clicked the button"); }
Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence