function getChecked(ename)
{
field = document.getElementsByName(ename);
var topub = new Array();
for (i = 0; i < field.length; i++)
if(field[i].checked == true)
{
topub.push(field[i].id);
}
return topub;
}
Above is what I used in such cases. I keep the name of all the flags the same, and then pass the name of this function and return an array. That way you can replace ur array with returned one. How:
var yourOldArray = new Array();<br>
yourOldArray = getChecked("name attribute of checkboxes");
All you need to make sure that all the checkboxes have the same value for the name attribute.
Johal source
share