Here s a simple little javascript function that makes an array of all checkboxes (video) in my form (myform), and builts another array of the checkboxes that are checked. It works great unless there s only 1 checkbox in the form. In that case boxes is undefined. Shouldn t this work with document.myform.video.length is 1?
function toggle(main) {
boxes = document.myform.video.length;
alert(boxes);
var videos = [];
for (i=0; i<boxes; i++) {
document.myform.video[i].checked = main.checked;
}
}