SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 1877 | Next

Joseph W. Lowery

"Dreamweaver CS3 Bible"

The group is composed of
tags with the same name attribute; the group can contain as few as two or as many
as necessary.
The input type radio, like checkbox, makes use of the checked property to see which option was
selected. The method used to figure out which of the radio buttons was chosen depends on the number of
buttons used on the form:
n With just two or three buttons, you may want to use a simple if-else construct to determine which
radio button was selected.
n If you are offering many options, you can use a loop structure to look at the checked property of
each radio button.
With only a couple of radio buttons in a group, you can examine the one radio-type item in the array (starting
with 0) to see if it was checked. In the following code, if one radio button is selected, the variable
(theChoice) is set to one value; otherwise, it is set to the other value:
if (document.forms[0].comm[0].checked == ???1???)
theChoice = ???left???;
else
theChoice = ???right???;
When you have many radio buttons, or you don??™t know how many radio buttons you might have, use a
counter loop such as the one shown in this next example from the Enhanced LineBreak object:
for (var i = 0; i < document.theForm.lbreak.length; i++) {
if (document.


Pages:
1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889