Mozilla XUL Element and Script Reference

Contents  Quick Reference

Checkbox

An element that can be turned on and off. This is most commonly rendered as a box when the element is off and a box with a check when the element is on. The user can switch the state of the check box by selecting it with the mouse. A label, specified with the value attribute may be added beside the check box to indicate to the user as to its function.

Example:

    <checkbox value="Enable JavaScript" checked="false"/>

Attributes:

Attributes inherited from XUL Element


accesskey

This should be set to a letter that is used as a shortcut key. This letter should be one of the characters that appears in the label text for the checkbox. This letter will typically be drawn underlined, although this behavior will be platform and skin specific. When the user presses ALT (or a similar key that varies on each platform) and the access key, the checkbox will be activated from anywhere in the window.

checked

Indicates whether the checkbox is checked or not.

crop

If the label of the checkbox is too small to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be placed in place of the cropped text.

disabled

If this attribute is set to true, the checkbox is disabled. This is usually drawn with the text in grey. If the checkbox is disabled, the function of the button cannot be performed. The value may also be set to false for a regular active button. If this attribute is left out entirely, the button is enabled.

flex

Indicates the flexibility of the checkbox. Flexible elements grow and shrink to fit their given space. The actual value is not relevant unless there are other flexible elements with-in the same container. Elements with larger flex values will grow more than elements with lower flex values, at the ratio determined by the two elements.

height

The height of the checkbox in pixels. It is recommended to use the CSS height property instead.

left

For elements placed within a bulletinboard, specifies the position of the left edge of the checkbox.

orient

Used to specify whether the children of the checkbox element are oriented horizontally or vertically.

src

The URL of the image to appear on the checkbox. If this is attribute is left out, no image appears.

top

For elements placed within a bulletinboard, specifies the position of the top edge of the checkbox.

value

The label that will appear on the checkbox. If this is left out, no text appears.

width

The width of the checkbox in pixels. It is recommended to use the CSS width property instead.

JavaScript Properties and Methods:

Properties and Methods inherited from XUL Element

checked

Returns true if the checkbox is checked and false if the checkbox is unchecked.

accesskey

Gets and sets the value of the accesskey attribute.

crop

Gets and sets the value of the crop attribute.

disabled

Gets and sets the value of the disabled attribute.

imgalign

Gets and sets the value of the imgalign attribute.

src

Gets and sets the value of the src attribute.

value

Gets and sets the value of the value attribute.