SoFunction
Updated on 2025-04-10

Javascript implements TreeView CheckBox selection effect


function OnTreeNodeChecked() {
var ele = ;
if ( == 'checkbox') {
var childrenDivID = ('CheckBox', 'Nodes');
var div = (childrenDivID);
if (div != null) {
var checkBoxs = ('INPUT');
for (var i = 0; i < ; i++) {
if (checkBoxs[i].type == 'checkbox')
checkBoxs[i].checked = ;
}
}
OnTreeNodeChildChecked(ele);

}
}
function OnTreeNodeChildChecked(ele) {
//Automatically process the superior
var parentDiv = ;
var parentChkBox = (('Nodes', 'CheckBox'));
if (parentChkBox != null) {
var ChildsChkAll = true;
var Boxs = ('INPUT');
for (var i = 0; i < ; i++) {
if (Boxs[i].type == 'checkbox' && Boxs[i].checked == false) {
ChildsChkAll = false;
}
}
= ChildsChkAll;
OnTreeNodeChildChecked(parentChkBox);
}
}