I want to have a linkbutton that when pressed checks/unchecks all the checkboxes on a treeview. How can I achieve this with Javascript?
I researched and found this code but I can't seem to make it work.
function selectAllNone(value) {
var tvNodes = document.getElementById("trvMenu");
var chBoxes = tvNodes.getElementsByTagName("input");
for (var i = 0; i < chBoxes.length; i++) {
var chk = chBoxes[i];
if (chk.type == "checkbox") {
chk.checked = value;
}
}
return false;
}
Aucun commentaire:
Enregistrer un commentaire