Login Register

SelectAll function for checkboxes

I have a checkbox list generated from the database, and I want to have the possibility to select all the generated (dojo) checkboxes (listed in a Dialog), I tried to do this :

function checkAll()
{
var boxes = document.getElementById("checkB").getElementsByTagName("input");
for (var i = 0; i < boxes.length; i++) {
myType = boxes[i].getAttribute("type");
if ( myType == "checkbox") {
boxes[i].checked=1;
}
}
}
echo 'Check All';

...... the checkboxes are listed here

is there better Idea ?

thanks