The following code allows me to mark a set of several other checkboxes by checking just one.
<script language=”javascript”>
var i
function checkBoxes() {
if (checkTheBoxes.checkAll.checked == true) {
for (i=0; i < checkTheBoxes.CampSite.length; i++) {
document.checkTheBoxes.CampSite[i].checked = true;
}
}
if (checkTheBoxes.checkAll.checked == false) {
for (i=0; i < checkTheBoxes.CampSite.length; i++) {
document.checkTheBoxes.CampSite[i].checked = false;
}
}
}
</script>
However, to accomplish this, the other campsites must all be named CampSite. Is there a way to modify the above so I can name the checkboxes say, CampSite1, Campsite2, ect. and then still mark all the checkboxes that begin with CampSite by checking one single “Select All” box?