Button object (Object/DOM)

An object representing an <INPUT TYPE="button"> HTML button in a form.

Availability:

DOM level - 1
JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Opera - 3.0
Inherits from:Input object
JavaScript syntax:-myButton = myDocument.aFormName.anElementName
-myButton = myDocument.aFormName.elements[anItemIndex]
IEmyButton = myDocument.all.anElementID
IEmyButton = myDocument.all.tags("INPUT")[anIndex]
IEmyButton = myDocument.all[aName]
-myButton = myDocument.forms[aFormIndex].anElementName
-myButton = myDocument.forms[aFormIndex].elements[anItemIndex]
-myButton = myDocument.getElementById(anElementID)
-myButton = myDocument.getElementsByName(aName)[anIndex]
-myButton = myDocument.getElementsByTagName("INPUT")[anIndex]
HTML syntax:<INPUT TYPE="button">
Argument list:anItemIndexA valid reference to an item in the collection
aNameThe name attribute of an element
anElementIDThe ID attribute of an element
aFormIndexA reference to a single form in the forms collection
anIndexA valid reference to an item in the collection
Object properties:type, value
Object methods:handleEvent()
Event handlers:onAfterUpdate, onBeforeUpdate, onBlur, onClick, onDblClick, onErrorUpdate, onFilterChange, onFocus, onHelp, onKeyDown, onKeyPress, onKeyUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp, onRowEnter, onRowExit

Many properties, methods and event handlers for this object are inherited from the Input object class. Refer to topics grouped with the "Input" prefix for details of common functionality across all sub-classes of the Input object super-class.

There isn't really a Button object class in Netscape, but it is helpful when trying to understand the wide variety of input element types if we can reduce the complexity by discussing only the properties and methods of a button. In actual fact, the object is represented as an item of the Input object class.

In MSIE, there is a special BUTTON class that is used to represent a <BUTTON> tag. It is documented separately in its own topics. The Button object is the correct spelling for a DOM level 1 compliant implementation.

Event handling support via properties containing function objects was added to Button objects at version 1.1 of JavaScript.

Warnings:

See also:Element object, Element.isTextEdit, Form.elements[], FormElement object, Input object, Input.accessKey, onClick, TextRange object

PropertyJavaScriptJScriptNIEOperaNESECMADOMCSSHTMLNotes
type1.1 1.11.0 1.03.0 3.03.02 3.023.0 3.0 n/a n/a1 1 n/a n/aReadOnly
value1.0 1.01.0 1.02.0 2.03.02 3.023.0 3.0 n/a n/a1 1 n/a n/aWarning

MethodJavaScriptJScriptNIEOperaNESECMADOMCSSHTMLNotes
handleEvent()1.2 1.2 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a n/a-

Event nameJavaScriptJScriptNIEOperaNESECMADOMCSSHTMLNotes
onAfterUpdate n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onBeforeUpdate n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onBlur1.1 1.13.0 3.03.0 3.04.0 4.03.0 3.0 n/a n/a n/a n/a n/aWarning
onClick1.0 1.03.0 3.02.0 2.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onDblClick1.2 1.23.0 3.04.0 4.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onErrorUpdate n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onFilterChange n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onFocus1.0 1.03.0 3.02.0 2.04.0 4.03.0 3.0 n/a n/a n/a n/a n/aWarning
onHelp n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/aWarning
onKeyDown1.2 1.23.0 3.04.0 4.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onKeyPress1.2 1.23.0 3.04.0 4.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onKeyUp1.2 1.23.0 3.04.0 4.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onMouseDown1.2 1.23.0 3.04.0 4.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onMouseMove1.2 1.23.0 3.04.0 4.04.0 4.0 n/a n/a n/a n/a n/a4.0 4.0Warning
onMouseOut1.1 1.13.0 3.03.0 3.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onMouseOver1.0 1.03.0 3.02.0 2.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onMouseUp1.2 1.23.0 3.04.0 4.04.0 4.03.0 3.0 n/a n/a n/a n/a4.0 4.0Warning
onRowEnter n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-
onRowExit n/a3.0 3.0 n/a4.0 4.0 n/a n/a n/a n/a n/a n/a-

Inheritance chain:

Element object, Input object, Node object