Declares a preference that may be adjusted in a prefpane. This element must be placed inside a preferences element. Each preference element corresponds to a preference which is stored in the user's preferences file. You can connect a user interface element such as a checkbox to a preference element using the user interface element's preference attribute.
More information is available in the Preferences System article.
<preferences> <preference id="pref_id" name="preference.name" type="int"/> </preferences>
See Preferences System for a complete example.
disabledcommand event will not fire. In the case of form elements, it will not be submitted. Do not set the attribute to true, as this will suggest you can set it to false to enable the element again, which is not the case.
disabled attribute is allowed only for form controls. Using it with an anchor tag (an <a> link) will have no effect.disabled property which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update additional state.instantApplytrue, the preference will be changed as soon as the user interface is modified.invertedtrue, it indicates that the value of the preference is the reverse of the user interface element attached to it. For instance, checking the checkbox disables the preference instead of enabling it.namebrowser.startup.homepage.An onchange attribute is an event listener to the object for the Event change. A change event is fired in different ways for different XUL Input Elements as listed below:
onchange| TextBox | When Enter key is pressed |
| Radio/Check Box | When the state is changed |
| Select List | When the selected item is changed |
The script context at this point can only access the following things:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window
id="findfile-window"
title="Find Files"
orient="horizontal"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="text/javascript">
function myFunction(e){
/*
Do something cool here or just say the below
*/
alert(e.target.nodeName);
}
</script>
<textbox id="find-text" onchange="return myFunction(event);"/>
</window>
readonlytrue, then the user cannot change the value of the element. However, the value may still be modified by a script.tabindextab" key. Elements with a higher tabindex are later in the tab sequence.typebooltrue or false. Usually a checkbox would be connected to these preferences.intstringunicharwstringfiledefaultValue (readonly)type property.null.hasUserValueTrue if the preference has been changed from its default value.instantApply (readonly boolean)true if either the element has an instantApply attribute set to true, or the <prefwindow>'s instantApply property is true. (But note bug 451025.)lockedtrue, the preference has been locked and disabled in the system configuration, preventing the value from being changed. This property is read-only.namepreference to change. For example, the browser's home page is set with the preference browser.startup.homepage.preferencespreferences element.readOnlytrue, then the user cannot modify the value of the element.valuename. In pref dialogs with instantApply == true (default on Mac OS X) this value is kept in sync with the actual value stored in the preferences (see valueFromPreferences). When instantApply is off (default on Windows), this gets and sets the current value of the preference in the currently open dialog.value === undefined, indicating that the preference does not have a user-set value (hasUserValue == false). In this case the actual value to be displayed in the UI is obtained from the defaultValue property.valueFromPreferencesname. (This always accesses the nsIPrefBranch APIs regardless of the instantApply mode in effect).reset()textbox it also clears the undo transaction list (Gecko 1.9).type getElementValue(in DOMElement element);onsynctopreference.boolean isElementEditable(in DOMElement element)true, if the given element is "editable" (see below).void setElementValue(in DOMElement element);onsyncfrompreference.void updateElements();changeonchange/change event is fired on the <preference> element. You can handle this if you wish to.Preferences System documentation:
prefwindow | prefpane | preferences | preference | XUL attributes