
| Check boxes are stand-alone elements; that is, they don't interact with neighboring elements like radio buttons do. Therefore they are a bit easier to use. Using JavaScript you can test if a check box is checked or not using the checked property. Likewise, you can set the checked property to add or remove the checkmark from a check box. |
| <SCRIPT>
function testButton(form)
{ for (Count = 0; Count
< 3; Count++) { //
if (alertStr ==
"") alertStr = "No CheckBox was selected"; alert(alertStr); </SCRIPT> <FORM NAME="testform"> As with the radio button object, add a CHECKED attribute to the HTML for that check box you wish to be initially check when the form is first loaded. <INPUT TYPE="checkbox" NAME="check1" VALUE="Check1" CHECKED>Checkbox 1 You can also set the button selection programmatically with JavaScript, using the CHECKED Property. Specify the name of the checkbox you want to check, as in
|