
Originally Posted by
Twey
Erm... if I were you, I'd give them all ids [...]
That's not really necessary, and a bit messy in my opinion:
Code:
var form = ...,
group = form.elements['cat[]'];
for(var i = 0, n = group.length; i < n; ++i) {
group[i].disabled = true;
}
and similar for enabling the checkboxes.
<input type="radiobutton"
Just 'radio'. 
The nicest way to set the form variable above is to pass it to the function when calling. The code below is generic, but you could hard-code values if you wanted to.
Code:
function enableGroup(name, form) {
var group = form.elements[name];
for(var i = 0, n = group.length; i < n; ++i) {
group[i].disabled = false;
}
}
HTML Code:
<input type="radio" ... onclick="enableGroup('cat[]', this.form);">
Mike
Bookmarks