Note : The
<BUTTON> element is a new element introduced in HTML 4.0 draft specifications and is currently only supported by Internet Explorer 4.0.
<BUTTON> element can be used to create buttons that are embedded into the document. The main difference between
<INPUT TYPE="button"...>, is that the
<BUTTON> element takes the entire content between the opening and closing elements and creates a pushable button from them. This means that most HTML content can be rendered as a button. For example:
...produces a button with a HTML
<TABLE> rendered on it:
The attributes for the
<BUTTON> element are:
ACCESSKEY attribute can be used to specify a shortcut key for the
<BUTTON> (activated by pressing 'Alt' and the
ACCESSKEY together - like standard Windows applications menu shortcuts). The
ACCESSKEY setting does not have to be a character in the actual button contents and the button is not modified in any way to reflect that an
ACCESSKEY has been defined.
CLASS attribute is used to specify the
<BUTTON> element as using a particular style sheet class. See the Style Sheets topic for details.
DATAFLD attribute can be used to specify a data column name from the Data source (see
DATASRC) that the
<BUTTON> is bound to. For more information on the
DATAFLD attribute, see the Data Binding topic.
<BUTTON> element is data-bound, it can accept straight text, or HTML from the data source. The
DATAFORMATAS attribute should be set to "
TEXT" or "
HTML" accordingly. with
DATAFORMATAS="HTML", the data provided for the
<BUTTON> element is parsed and rendered when it's displayed.
For more information on the
DATAFORMATAS attribute, see the Data Binding topic.
DATASRC attribute can be used to specify a data source that the
<BUTTON> is bound to. For more information on the
DATASRC attribute, see the Data Binding topic.
DISABLED attribute can be used to disable the
<BUTTON>. This means it won't respond to user input, or take the users focus.
ID attribute can be used to either reference a unique style sheet identifier, or to provide a unique name for the
<BUTTON> element for scripting purposes. Any
<BUTTON> element with an
ID attribute can be directly manipulated in script by referencing its
ID attribute, rather than working through the All collection to determine the element. See the Scripting introduction topic for more information.
LANG attribute can be used to specify what language the
<BUTTON> element is using. It accepts any valid ISO standard language abbreviation (for example
"en" for English,
"de" for German etc.) For more details, see the Document Localisation section for more details.
LANGUAGE attribute can be used to expressly specify which scripting language Internet Explorer 4.0 uses to interpret any scripting information used in the
<BUTTON> element. It can accept values of
LANGUAGE attribute is set.
As well as using previously defined style sheet settings, the
<BUTTON> element can have in-line stylings attached to it. See the Style Sheets topic for details.
The Internet Explorer 4.0 (and above) specific
TITLE attribute is used for informational purposes. If present, the value of the
TITLE attribute is presented as a ToolTip when the users mouse hovers over the
<INPUT> elements shouldn't be included in a
<BUTTON> element in a document is an object that can be manipulated through scripting. Note that scripting of the
<BUTTON> element/object is only supported by Internet Explorer 4.0 in its Dynamic HTML object model. Netscape does not support direct scripting of the
<BUTTON> element at all.
<BUTTON...> element/object supports all of the standard Dynamic HTML properties (i.e. className, document, id, innerHTML, innerText, isTextEdit, lang, language, offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth, outerHTML, outerText, parentElement, parentTextEdit, sourceIndex, style, tagName and title). Details of these can be found in the standard Dynamic HTML properties topics.
<BUTTON> element supports the accessKey, dataFld, dataFormatAs, dataSrc and disabled, which directly reflect the attributes of the same name.
<BUTTON...> element/object supports all of the standard Dynamic HTML methods (i.e. click, contains, getAttribute, insertAdjacentHTML, insertAdjacentText, removeAttribute, scrollIntoView and setAttribute). Details of these can be found in the standard Dynamic HTML Methods topics.
<BUTTON> element also supports the following methods:
blur event can be used to force the users focus away from the referenced
<BUTTON> element, firing the
createTextRange method can be invoked to create a TextRange object from the contents of the
<BUTTON> element. See the TextRange object topic for details of properties, methods and events applicable to text ranges.
focus method can be used to pass the users focus to the referenced
<BUTTON> element, forcing the
onfocus event to fire.
<BUTTON...> element/object supports all of the standard Dynamic HTML events (i.e. onclick, ondblclick, ondragstart, onfilterchange, onhelp, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup and onselectstart). Details of these can be found in the standard Dynamic HTML events topics.
<BUTTON> element also supports:
When the referenced
<BUTTON> element loses the users focus, the
onblur event is fired.
When the user passes the focus to any
<INPUT> element, the
onfocus event is fired for that element.
© 1995-1998, Stephen Le Hunte