asp.net1.1下权限配置系统从设计到实现(四)

继续上次的吧,本来还有点瞌睡:) (昨晚的德国VS哥队够精彩),还是坚持写完吧.今天说哈 怎么实现Select All  TreeView全部节点的功能?怎么实现展开和折叠自如?
请看:
节点全部选中的实现:
function  SelectAllFunctions()
        {          
            
var  tree =  document.getElementById(' <%= tvRoleFunctions.ClientID %> ');
            
var  chckAll = document.getElementById(' <%= chSelectAll.ClientID %> ');
            
var  NodeArray = tree.getChildren();        
            
for ( var  i = 0 ;i < NodeArray.length;i ++ )
            {
                    cNode
= NodeArray[i];
                    
if (chckAll.checked )
                    {
                         cNode.setAttribute('checked',
true );
                         GetSelectedFunctionID(cNode);
                         Checked(cNode);                             
                    }
                    
else
                    {
                     cNode.setAttribute('checked',
false );
                     UnChecked(cNode);
                     }
            }
                    
        }    
function  Checked(node)
        {
                
var  NodeArray = node.getChildren();
                
for ( var  i = 0 ;i < NodeArray.length;i ++ )
                {
                     childNode
= NodeArray[i];
                     childNode.setAttribute('checked',
true );
                }
        }
function  UnChecked(node)
        {
                
var  NodeArray = node.getChildren();
                
for ( var  i = 0 ;i < NodeArray.length;i ++ )
                {
                     cNode
= NodeArray[i];
                     cNode.setAttribute('checked',
false );
                }
            
        }
节点的展开和折叠实现:
// TreeView的节点展开收回
function  ExpandAllNodes()
{
   
var  tree = document.getElementById(' <%= tvRoleFunctions.ClientID %> ');
   Expandedall(tree);
}

function  CollospaeAllNodes()
{
 
var  tree = document.getElementById(' <%= tvRoleFunctions.ClientID %> ');
 Unexpandedall(tree);
}
function  Expandedall(node)
{
        
var  i  =   0 ;
        
var  nodes  =   new  Array();
        nodes 
=  node.getChildren();
        
// alert(nodes.length);
         for (i  =   0 ; i  <  nodes.length; i ++ )
        {
            
var  cNode;
            cNode
= nodes[i];
            cNode.setAttribute(
" expanded " " true " );
            
if (parseInt(cNode.getChildren().length)  !=   0  )
            {
                Expandedall(cNode);
            }
        }
}
function  Unexpandedall(node)
{
        
var  i  =   0 ;
        
var  nodes  =   new  Array();
        nodes 
=  node.getChildren();
        
for (i  =   0 ; i  <  nodes.length; i ++ )
        {
            
var  cNode;
            cNode
= nodes[i];
            
if (parseInt(cNode.getChildren().length)  !=   0  )
            {
                Unexpandedall(cNode);
            }
            cNode.setAttribute(
" expanded " " false " );
        }
}
这个怎么调用就不用说了吧!呵呵........
下次写作预告:
在Firefox下TreeView的父子节点联动实现、节点的全部选择和节点的展开和折叠实现.....
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值