Availability: |
| |||||||
Inherits from: | Input object | |||||||
JavaScript syntax: | - | myButton = myDocument.aFormName.anElementName | ||||||
- | myButton = myDocument.aFormName.elements[anItemIndex] | |||||||
IE | myButton = myDocument.all.anElementID | |||||||
IE | myButton = myDocument.all.tags("INPUT")[anIndex] | |||||||
IE | myButton = 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: | anItemIndex | A valid reference to an item in the collection | ||||||
aName | The name attribute of an element | |||||||
anElementID | The ID attribute of an element | |||||||
aFormIndex | A reference to a single form in the forms collection | |||||||
anIndex | A 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.
Note that on MSIE, Input objects are actually INPUT objects, because MSIE follows a general rule of naming object classes after the capitalized name of the HTML tag that instantiates them. However, in some special cases, MSIE creates other object types. For buttons, it uses the BUTTON class.
Netscape does not support the defaultValue property for this sub-class of the Input object.
Property | JavaScript | JScript | N | IE | Opera | NES | ECMA | DOM | CSS | HTML | Notes |
---|---|---|---|---|---|---|---|---|---|---|---|
type | 1.1 ![]() | 1.0 ![]() | 3.0 ![]() | 3.02 ![]() | 3.0 ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | ReadOnly |
value | 1.0 ![]() | 1.0 ![]() | 2.0 ![]() | 3.02 ![]() | 3.0 ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | ![]() |
Method | JavaScript | JScript | N | IE | Opera | NES | ECMA | DOM | CSS | HTML | Notes |
---|---|---|---|---|---|---|---|---|---|---|---|
handleEvent() | 1.2 ![]() | ![]() | 4.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | - |
Event name | JavaScript | JScript | N | IE | Opera | NES | ECMA | DOM | CSS | HTML | Notes |
---|---|---|---|---|---|---|---|---|---|---|---|
onAfterUpdate | ![]() | 3.0 ![]() | ![]() | 4.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | - |
onBeforeUpdate | ![]() | 3.0 ![]() | ![]() | 4.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | - |
onBlur | 1.1 ![]() | 3.0 ![]() | 3.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
onClick | 1.0 ![]() | 3.0 ![]() | 2.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | 4.0 ![]() | ![]() |
onDblClick | 1.2 ![]() | 3.0 ![]() | 4.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | 4.0 ![]() | ![]() |
onErrorUpdate | ![]() | 3.0 ![]() | ![]() | 4.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | - |
onFilterChange | ![]() | 3.0 ![]() | ![]() | 4.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | - |
onFocus | 1.0 ![]() | 3.0 ![]() | 2.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
onHelp | ![]() | 3.0 ![]() | ![]() | 4.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
onKeyDown | 1.2 ![]() | 3.0 ![]() | 4.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | 4.0 ![]() | ![]() |
onKeyPress | 1.2 ![]() | 3.0 ![]() | 4.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | 4.0 ![]() | ![]() |
onKeyUp | 1.2 ![]() | 3.0 ![]() | 4.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | 4.0 ![]() | ![]() |
onMouseDown | 1.2 ![]() | 3.0 ![]() | 4.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | 4.0 ![]() | ![]() |
onMouseMove | 1.2 ![]() | 3.0 ![]() | 4.0 ![]() | 4.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | 4.0 ![]() | ![]() |
onMouseOut | 1.1 ![]() | 3.0 ![]() | 3.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | 4.0 ![]() | ![]() |
onMouseOver | 1.0 ![]() | 3.0 ![]() | 2.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | 4.0 ![]() | ![]() |
onMouseUp | 1.2 ![]() | 3.0 ![]() | 4.0 ![]() | 4.0 ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | 4.0 ![]() | ![]() |
onRowEnter | ![]() | 3.0 ![]() | ![]() | 4.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | - |
onRowExit | ![]() | 3.0 ![]() | ![]() | 4.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | - |
Prev | Home | Next |
Built-in object | Up | Button.handleEvent() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |