Syntax | <BUTTON>...</BUTTON> |
---|---|
Attribute Specifications |
|
Contents | |
Contained in | Block-level elements, inline elements except BUTTON |
The BUTTON element defines a submit button, reset button, or push button. Authors can also use INPUT to specify these buttons, but the BUTTON element allows richer labels, including images and emphasis. However, BUTTON is new in HTML 4.0 and poorly supported among current browsers, so INPUT is a more reliable choice at this time.
The TYPE attribute of BUTTON specifies the kind of button and takes the value submit (the default), reset, or button. The NAME and VALUE attributes determine the name/value pair sent to the server when a submit button is pushed. These attributes allow authors to provide multiple submit buttons and have the form handler take a different action depending on the submit button used.
Some examples of BUTTON follow:
<BUTTON NAME=submit VALUE=modify ACCESSKEY=M>Modify information</BUTTON>
<BUTTON NAME=submit VALUE=continue ACCESSKEY=C>Continue with application</BUTTON>
<BUTTON ACCESSKEY=S>Submit <IMG SRC="checkmark.gif" ALT="✔"></BUTTON>
<BUTTON TYPE=reset ACCESSKEY=R>Reset <IMG SRC="x.gif" ALT="✘"></BUTTON>
<BUTTON TYPE=button ID=toggler ONCLICK="toggle()" ACCESSKEY=H>Hide <strong>non-strict</strong> attributes</BUTTON>
The ACCESSKEY attribute, used throughout the preceding examples, specifies a single Unicode character as a shortcut key for pressing the button. Entities (HTML document takes precedence.
The BUTTON element also takes a number of attributes to specify client-side scripting actions for various events. In addition to the core events common to most elements, BUTTON accepts the following event attributes: