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 1876 | Next

Joseph W. Lowery

"Dreamweaver CS3 Bible"


Checkboxes
Checkboxes enable an option to be selected or deselected, so the only information that a function needs
from a checkbox is whether it has been selected. Dreamweaver??™s DOM enables you to read the checked
property of the checkbox object and act accordingly. The Character Entities object discussed in the preceding
section, for instance, uses a checkbox to turn on and off the Multiple Characters option. If the
checkbox (named cbMultiple) is selected, document.theForm.cbMultiple.checked is true, and
one set of statements is executed; otherwise, the second set of statements is run. The code for checkboxes
follows:
function getChar(val,val2) {
if(document.theForm.cbMultiple.checked) {
BC 18
Creating and Using Objects
document.theForm.charValue.value=
document.theForm.charValue.value+val
document.theForm.txChar.value=
document.theForm.txChar.value+val2
} else {
document.theForm.charValue.value=val
document.theForm.txChar.value=val2
}
}
Checkboxes are excellent for setting up yes/no situations. You can also use checkboxes to set (turn on) particular
attributes. You may, for instance, use a checkbox to make it possible for the user to enable an automatic
startup for a QuickTime movie or to turn the control panel on or off.
Radio buttons
Radio buttons offer a group of options from which the user can select only one.


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