W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0y
TV 1.2n
2.1n

<BUTTON>...</BUTTON>

Description

<Related pages>
* How do I use an image to submit a form?
This attribute creates a button that the user can push. The difference between this element and buttons created with the INPUT element is that inside a button element you can put content, like text or images. This content is then part of the button.

DTD

<!ELEMENT BUTTON - -
     (%flow;)* -(A|%formctrl;|FORM|FIELDSET)
     -- push button -->
<!ATTLIST BUTTON
  %attrs;                              -- %coreattrs, %i18n, %events --
  name        CDATA          #IMPLIED
  value       CDATA          #IMPLIED  -- sent to server when submitted --
  type        (button|submit|reset) submit -- for use as form button --
  disabled    (disabled)     #IMPLIED  -- unavailable in this context --
  tabindex    NUMBER         #IMPLIED  -- position in tabbing order --
  accesskey   %Character;    #IMPLIED  -- accessibility key character --
  onfocus     %Script;       #IMPLIED  -- the element got the focus --
  onblur      %Script;       #IMPLIED  -- the element lost the focus --
  >
from the HTML 4.0 DTD, "Copyright © W3C, (MIT, INRIA, Keio). All Rights Reserved."

Attributes

Core attributes: class id style title
Internationalization attributes: dir lang
Events: onclick ondblclick onmousedown onmouseup onmouseover onmousemove onmouseout onkeypress onkeydown onkeyup

W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2n
2.1n
ACCESSKEY
Description of the accesskey attribute
W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0y
TV 1.2n
2.1n
DISABLED
This attribute makes the button non-functional.
W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0y
TV 1.2n
2.1n
NAME
Give the button a name that can be used in scripts. This name is also sent to the server when the form is submitted.
W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0y
TV 1.2n
2.1n
TABINDEX
Description of the TABINDEX attribute
W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0y
TV 1.2n
2.1n
TYPE
This attribute defines the type of button. These are the possible values:

Value Description
button Creates a button. The action that is triggered by using this button is defined by the ONCLICK attribute.
reset Creates a button that users can click to reset form fields to their initial state when the document was first loaded. Reset buttons are never sent as part of the form's contents.
submit Creates a button that users can click to submit the form's contents to the server. If the name attribute is given then the submit button's name/value pair will be included in the submitted data. You can include several submit buttons in the form.


W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0y
TV 1.2n
2.1n
ONBLUR
Description of the ONBLUR attribute
W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0y
TV 1.2n
2.1n
ONFOCUS
Description of the ONFOCUS attribute
W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0y
TV 1.2n
2.1n
VALUE
Set the initial value of the button. This value can be changed by scripts.

Examples

Source
<FORM>
<BUTTON type="reset" accesskey="r" tabindex="2">Reset the<BR>form values</BUTTON>
</FORM>
 
Result
 
Source
<FORM>
<BUTTON type="button" tabindex="1"><IMG src="IMG1.gif"></BUTTON>
</FORM>
 
Result
Statistics