34,333
edits
Changes
→JavaScript Radio Buttons
The Check Box object has one JavaScript event, ''onClick'', which is triggered when the user clicks on the box, and one method, ''click()'', which simulates a user click when called.
== JavaScript HTML Radio Buttons ==
The JavaScript HTML Radio Button object takes its name from the buttons on an old style radio. In the old days a radio would a have a number of buttons for making selections (such as frequency band). Depressing one button would cause the currently selected button to pop up, thereby ensuring that only one button was pressed at any one time. JavaScript HTML Radio Buttons provide a similar functionality for situations where a "one of many" choice is to be presented to the user.
The syntax for creating a group of Radio Buttons is as follows:
All three button share the same ''name'' attribute which acts to tie them together into a group. The ''value'' attribute defines the value that is passed through the server to indicate which button is selected when the form is submitted.
Ther are number of actions that can be performed in using JavaScript when working with Radio Buttons. Firstly, you can find out the number of Radio Buttons ina group by accessing the ''length'' property:
<pre>