In. in the environment of net framework1.1, call the Treeview control to generate a tree chart and click the parent node. Then, all the child nodes are selected and the child nodes under the selected parent node are canceled, the parent node is also deselected.
Treeview. js
Function check (treeview1)
{
CIndex = treeview1.clickednodeindex;
Pnode = treeview1.gettreenode (cIndex );
Checked (pnode );
Unchecked (pnode );
}
Function checked (node)
{
VaR nodearray = node. getchildren ();
Checked = node. getattribute ("checked ");
For (VAR I = 0; I <nodearray. length; I ++)
{
CNode = nodearray;
CNode. setattribute ('checked', checked );
If (cNode. getchildren (). length> 0)
{
Checked (cNode );
}
}
}
Function unchecked (node)
{
Checked = node. getattribute ("checked ");
If (! Checked & node. getparent ()! = NULL)
{
Node. getparent (). setattribute ('checked', checked );
Unchecked (node. getparent ());
}
}
Note: You must set the Autoselect attribute in the Treeview control to true.