Chapter 35. Button Objects
IN THIS CHAPTER
Triggering action from a user's click of a button
Assigning hidden values to radio and checkbox buttons
Distinguishing between radio button families and their individual buttons
This chapter is devoted to those lovable buttons that invite users to initiate action and make choices with a single click of the mouse. In this category fall the standard system-looking buttons with labels on them, as well as radio buttons and checkboxes. For such workhorses of the HTML form, these objects have a limited vocabulary of object-specific properties, methods, and event handlers.
We group together the button, submit, and reset objects for an important reason: They look alike, yet they are intended for very different purposes. Knowing when to use which button is important—especially in choosing between the button and submit objects. Many a newcomer get the two confused and wind up with scripting error headaches. That confusion won't be an issue for you by the time you finish this chapter.
The button Element Object, and the Button, Submit, and Reset Input Objects
For HTML element properties, methods, and event handlers, see Chapter 26, "Generic HTML Element Objects".
Properties | Methods | Event Handlers |
---|---|---|
|
|
|
|
| |
|
| |
|
Syntax
Accessing button object properties or methods:
(All) [window.]document.formName.buttonName.property | method([parameters]) (All) [window.]document.formName.elements[index].property | method([parameters]) (All) ...
Get JavaScript® Bible, Seventh Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.