HTML and CSS Reference
In-Depth Information
Figure 11.40 Multiple selections were made by the avid traveller.
Radio Buttons. Like the buttons on an old-fashioned radio, you can only push one
button when using HTML radio buttons. When a radio button is checked, it is selected,
and when another button is checked, the previously checked one is deselected. In short,
only one button at a time can be checked. This type of button is useful if you want a user
to be able to select only one of a list of items.
Radio buttons are created with the HTML <input type=“radio”> and are represented
in JavaScript as a radio object with specific properties and methods used to manipulate
the object. Each button is a property of the radio object and assigned to an array of ele-
ments in the order in which they are placed in the form. The checked property of the
radio object specifies whether a button was checked. It returns Boolean true if the button
was selected, and false if not.
window
document
form
radio
Figure 11.41 How the radio object is created within the JavaScript hierarchy.
 
Search WWH ::




Custom Search