I have an application where a set of checkboxes needs to be logically grouped. One checkbox may belong to more than one group. The Javascript task is to check/uncheck all checkboxes in the group when the group itself was checked/unchecked. But if one checkbox occured more than once, it should be checked/unchecked in all groups it occurs. The group membership is implemented by a two-dimensional array "lgroup". The invariant condition lgroup[j] = n means that checbox "n" occurs as member no "j" in group "i". The checkboxes are presented to the user in a table, grouped by the groups. I attach an onClick event handler checkGroup to the group checkbox. The event handler gets the group number g as input parameter, and uses getElementById to access the group checkbox. Then it goes on looping throup lgroup[g] and retrieves the corresponding checkboxes. This must be done by getElementsByName since each box may occur more than once. Now we must have an inner loop on this function return, in case it returned more than one element. All code is pretty straightforward, and it works fine in both Opera and MSIE, but not in Firefox for some unknown reason! My debugging indicates that it has something to do with getElementsByName, but I am not really sure. The Javascript error console says that "gbox has no properties", which indicates that gbox was not successfully retrieved by getElementById. But in my first try, I also used getElementById instead of getElementsByName (boxes had ids instead of names then). Then the code also worked in Firefox but the script code was only able to check one occurence of the boxes in a group, even if one box occured more than once. So this is the reason I suspect the Firefox problem is related to the use of getElementsByName. The Javascript code for the function checkGroup follows below. A fully working HTML file can be found here where it can be tested : www.skiforeningen.no/markadb/checkbox_problem.html (Sorry I was not able to hyperlink the URL) function checkGroup(g) { // which group checkbox (gbox) was clicked? Read "checked" and "value" property for use further down var gbox = document.getElementById('lg' + g); var gstatus = gbox.checked; var gvalue = gbox.value; var l = 0; var lbox; // Loop through this group and check or uncheck member checkboxes in this group for (var i = 0; i < lgroup[g].length; i++) { // Pick up box number in array, used to create full name of box l = lgroup[g][i]; // Need to use getElementsByName since a named checkbox may occur more than once lbox=document.getElementsByName("prepstatus_" + l); // Loop through all occurrences and set same status as group g (gbox) for (var j = 0; j < lbox.length; j++) { lbox[j].value=gvalue; lbox[j].checked=gstatus; } } } Code (markup):