oncommand
for command events on XUK widgets. Note that these events correspond to events sent by widget after the end of a change. Contrary to the onchange
events, events sent before the end of a continuous change (such as the moving of a scale won't be sentonclick
for click events on XUL widgets. It will have the same result that "oncommand", for widgets which have click events (such as button)onchange
for change events on XUL widgets. In this case, events sent before the end of a continuous change will be sentonselect
for selection events on XUL widgetsonmouseover
for mouse over events on XUL widgets. This event is available on all widgetsonmouseout
for mouse exit events on XUL widgets. This event is available on all widgetsonload
for load events on XUL window. In this case, events sent before the end of a continuous change will be sent. The "onload" event is only available for the window element. This event will be sent for all XUL document windows when the framework is startedoncommand
, onclick
or onchange
attribute must correspond to a function in a Javascript script.
<?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window title="Example" width="200" height ="200" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> function checked() { print("clicked!"); } </script> <button oncommand="checked()" /> </window>
<?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="Test" title="Test XULScripts" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> function changeValue() { var value = document.getElementById('scale').value; print(value); } </script> <vbox> <scale id="scale" width="200" min="0" max="100" oncommand="changeValue()" /> </vbox> </window>
<?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="Test" title="Test XULScripts" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> function select() { var index = document.getElementById("theList").currentIndex; print("selected " + index); } </script> <listbox onselect="select()"> <listitem label="Ruby"/> <listitem label="Emerald"/> <listitem label="Sapphire"/> <listitem label="Diamond"/> </listbox> </window>
<?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="Test" title="Test XULScripts" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> function hover() { print("hover"); } </script> <label onmouseover="hover()" /> </window>
<window id="Test" title="Test XULScripts" orient="horizontal" onload="loaded()" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> function loaded() { document.getElementById("theButton").label = "No"; } </script> <button id="theButton" label="Yes"/> </window>
Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence