Radio Buttons
-
Only one can be chosen at a time, like a car's radio preset buttons (hence
the name).
-
Example:
<INPUT TYPE ="RADIO" NAME="year" VALUE="1" CHECKED>Year 1
<INPUT TYPE ="RADIO" NAME="year" VALUE="2">Year 2
<INPUT TYPE ="RADIO" NAME="year" VALUE="3">Year 3
<INPUT TYPE ="RADIO" NAME="year" VALUE="4">Year 4
<INPUT TYPE ="RADIO" NAME="sal" VALUE="Mr" CHECKED>Mr
<INPUT TYPE ="RADIO" NAME="sal" VALUE="Mrs">Mrs
<INPUT TYPE ="RADIO" NAME="sal" VALUE="Ms">Ms
<INPUT TYPE ="RADIO" NAME="sal" VALUE="Dr">Dr
-
The radio buttons are identified in groups by the NAME attribute.
So, one year can be checked, and one salutation can be checked
at the same time, but no more than one from each group.
-
radio object:
-
name - the name of the group, as specified in the NAME tag.
-
length - number of buttons in the group
-
radio object array:
-
value - VALUE tag
-
defaultChecked - CHECKED button
-
checked - button's current state.
-
click() - simulates a click. Automatically sets others to
false.
-
If you used the checked attribute, you have to set
the others to false manually. How can you do this with a loop?
Drop Down Lists
Home
Internet II: Day 4