日期:2014-05-18  浏览次数:20495 次

怎么样实现treeview的联动啊
怎么样实现treeview的联动啊

------解决方案--------------------
<asp:TreeView ID="tvSGMT" runat="server" Height="100%" ShowCheckBoxes="All" ShowLines="True" onclick="OnTreeNodeChecked()" >
</asp:TreeView>

JScript code

<script language="javascript" type="text/javascript">
    function OnTreeNodeChecked() 
    { 
        var ele = event.srcElement; 
        if(ele.type=='checkbox') 
        { 
            var childrenDivID = ele.id.replace('CheckBox','Nodes');
            var div = document.getElementById(childrenDivID); 
            if(div != null)
            {
                var checkBoxs = div.getElementsByTagName('INPUT'); 
                for(var i=0;i<checkBoxs.length;i++) 
                { 
                    if(checkBoxs[i].type=='checkbox') 
                    checkBoxs[i].checked=ele.checked; 
                }
            }            
        } 
    }
</script >