I have a table with 12 checkboxes. I have the following function which when I check the last checkbox in the table, the first 10 checkboxes in the table are unchecked. -
function modify_boxes(to_be_checked,total_boxes){ for ( i=0 ; i < total_boxes ; i++ ){ if (to_be_checked){ document.forms[0].x[i].checked=true; } else{ document.forms[0].x[i].checked=false; } } }
I have the following in 'onclick' on the last checkbox in the table -
modify_boxes(false,10)
What I would like to happen, is when the first checkbox in the table is checked, that only the last two checkboxes in the table are unchecked. However the names of the checkboxes must all be 'x' as they are referenced elsewhere
thanks in advance