Forum Moderators: open
If the user selects ALL possible items in the select box (say there are 20, then he selects 20, if there are 100, he selects 100), then I need to to make a checkbox checked. If he selects less than all the possible items (99/100, 1/100, etc..), then I need to uncheck a checkbox.
How is this possible in javascript? The number of items in the multiple select box change.
function pick()
{
var allSelected=true;
var totVars=document.forms[0].committee.length;
for(x=0;x<totVars; x++) {
if (!(document.forms[0].committee[x].selected))
allSelected=false;
}
if(allSelected) {
document.forms[0].committee_null.checked=true;
} else {
document.forms[0].committee_null.checked=false;
}
}
</script>