A button that can be pressed by the user. Event handlers can be used to trap mouse, keyboard and other events. It is typically rendered as a grey outset rectangle. You can specify the label of the button using the label
attribute or by placing content inside the button.
More information is available in the XUL tutorial.
<button label="Press Me" oncommand="alert('You pressed me!');"/>
accesskey
label
attribute for the element.
autocheck
true
or left out, the checked state of the button will be switched each time the button is pressed. If this attribute is false
, the checked state must be adjusted manually. When autocheck is true, the button type should be "checkbox" or "radio".checkState
0
, 1
, or 2
autoCheck
attribute to false
and adjust the state with a script. The type
attribute must be set to checkbox
for buttons with a check state. Constants for the possible values for this attribute are in the nsIDOMXULButtonElement
interface.checked
hasAttribute()
to determine whether this attribute is set instead of getAttribute()
.type
attribute must be set to checkbox
or radio
for this attribute to have any effect.crop
crop
attribute. An ellipsis will be used in place of the cropped text. If the box direction is reversed, the cropping is reversed.start
end
left
right
center
none
none
and the displayed text is larger than this maximum width, you may be able to use the max-width CSS property (or the maxwidth attribute) to override this size. For example, for a menuitem in a menu you can add the following CSS rule when you want to use the value none
:menupopup > menuitem, menupopup > menu { max-width: none; }
dir
normal
reverse
disabled
command
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.dlgtype
dlgType
is set to accept
, the button will replace the dialog box's accept button, which is usually labeled OK
. Using this attribute on a button that is not in a dialog box has no effect. The following values can be used as the dialog type:accept
cancel
help
disclosure
extra1
extra2
group
icon
image
attribute. Possible values include: accept
, cancel
, help
, open
, save
, find
, clear
, yes
, no
, apply
, close
, print
, add
, remove
, refresh
, go-forward
, go-back
, properties
, select-font
, select-color
, network
. If you are using a button that matches one of these common usages, use the icon
attribute to indicate this. See the appearance of the different icons on some available platforms.orient
-moz-box-orient
style property.
horizontal
vertical
tabindex
tab
" key. Elements with a higher tabindex
are later in the tab sequence.
accessibleType
checkState
0
, 1
, or 2
checkState
attribute.nsIAccessibleProvider
, nsIDOMXULButtonElement