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.
The <BUTTON>
element can be used to create buttons that are embedded into the document. The main difference between <BUTTON>
and <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:
<BUTTON>
<TABLE BORDER="1">
<TR>
<TD>A</TD><TD>B</TD>
</TR><TR>
<TD>C</TD><TD>D</TD>
</TR>
</TABLE>
</BUTTON>
...produces a button with a HTML <TABLE>
rendered on it:
The attributes for the <BUTTON>
element are:
ACCESSKEY
The 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
The CLASS
attribute is used to specify the <BUTTON>
element as using a particular style sheet class. See the Style Sheets topic for details.
DATAFLD
The 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.
DATAFORMATAS
When the <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
The 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
The DISABLED
attribute can be used to disable the <BUTTON>
. This means it won't respond to user input, or take the users focus.
ID
The 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
The 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
The 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 vbscript
, vbs
, javascript
or jscript
. The first two specify the scripting language as Visual Basic Script, the latter two specify it as using Javascript (the default scripting language used if no LANGUAGE
attribute is set.
STYLE
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.
TITLE
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 <BUTTON>
section.
Note : <SELECT>
, <A>
or <INPUT>
elements shouldn't be included in a <BUTTON>
Every <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...>
Properties
The <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.
Additionally, the <BUTTON>
element supports the accessKey, dataFld, dataFormatAs, dataSrc and disabled, which directly reflect the attributes of the same name.
<BUTTON...>
Methods
The <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.
The <BUTTON>
element also supports the following methods:
blur
The blur
event can be used to force the users focus away from the referenced <BUTTON>
element, firing the onblur
event.
createTextRange
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
The focus
method can be used to pass the users focus to the referenced <BUTTON>
element, forcing the onfocus
event to fire.
<BUTTON...>
Events
The <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.
The <BUTTON>
element also supports:
onblur
When the referenced <BUTTON>
element loses the users focus, the onblur
event is fired.
onfocus
When the user passes the focus to any <INPUT>
element, the onfocus
event is fired for that element.
© 1995-1998, Stephen Le Hunte
file: /Techref/language/html/ib/Text_Formatting/but.htm, 12KB, , updated: 2010/9/8 20:26, local time: 2024/11/28 04:11,
3.144.40.216:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://sxlist.com/Techref/language/html/ib/Text_Formatting/but.htm"> <BUTTON></A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to sxlist.com! |
.