I am having the same problem. The only way I can see to do this is to use PHP to write the javascript code and use explicit references to the checkboxes instead of using javascript variables.
Name all of your checkboxes like myBoxVariable1, myBoxVariable2, etc. You can use PHP to dynamically create these.
Use this javascript function to convert the myBoxVariable's to something that can be accessed in loops etc. It can be called with onClick="setCheckboxes()" in your html button/link/etc.
Here I uncheck all boxes when the function is called as an example. I used PHP to set the condition on the for loop since javascript will have a hard time counting the boxes with this naming convention and I am dynamically creating them with PHP anyway so I already know how many there are.
function setCheckboxes()
{
var temp;
for (var i = 1; i <= <? echo $NumBoxes; ?>; i++) {
temp=eval("document.myFormName.myBoxVariable" + i);
temp.checked=false;
}
return true;
}
Then in PHP you can take the separate variables and enter them into an array:
$myBoxVariable = array();
for($i=0; $i<$NumBoxes; $i++){
$temp = "myBoxVariable" . $LogoNum;
$myBoxVariable[$i] = $_POST[$temp];
}
I searched for hours and this is the only cross-compatible reliable solution. You can use getElementById to refer to check boxes instead but it isn't compatible with all browsers.