I have a series of checkboxes and multiple select lists, that are used to choose which mailing lists to subscribe to.
The checkboxes are called mail[1], mail[2] etc
and the select boxes sel[1], sel[2] etc
I want it so that when i click on mail[1] it selects all the options in sel[1].
its called by onclick="DoAll('n')" (where n is the number, 1,2 etc)
Does anyone know why this isnt working?
Code:
function DoAll(id) {
if (document.action.mail[id].selected==true) {
for(var i=0;i<document.action.sel[id].length;i++) {
document.action.sel[i].selected=true;
}
}
if (document.action.mail[id].selected==false) {
for(var i=0;i<document.action.sel[id].length;i++) {
document.action.sel[i].selected=false;
}
}
}