如题

解决方案 »

  1.   

    http://www.cnblogs.com/renrenqq/archive/2004/05/20/10534.html
      

  2.   


     <div id="resoucreDiv" style="width: 100%; margin-top: 5px; margin-bottom: 5px; background-color: White;">
                                    <asp:TreeView ID="treeModule" runat="server" Width="100%" HoverNodeStyle-BackColor="White"
                                        BorderWidth="1" BorderStyle="Outset" BorderColor="#99bbe8">
                                        <RootNodeStyle Font-Bold="True" Font-Size="11pt" />
                                    </asp:TreeView>
    </div>js
    [code=JScript]
     google.load("jquery", "1.4.3");
            google.setOnLoadCallback(function() {            //加载时判断父节点是否选中状态
               // OnloadTreeNode();            //点击该div下的checkbox时加载点击事件
                $("div[id='resoucreDiv'] input[type='checkbox']").bind("click", CheckSub);            //返回
                $("#btback").bind('click', function(key, val) { history.go(-1); });            //修改
                $("#btModule").bind('click', GetJson);        });        function OnloadTreeNode() {            var isBoolen = false;
                alert($("div[id='treeModule']").children("div").length);
                $("div[id='resoucreDiv'] input[type='checkbox']").each(function(key, val) {
                    if (parseInt(key) == 0) {
                        TreeNodeId = $(this).attr("id").toString(); //得到父级ID号
                    }
                    else {
                        if ($(this).attr('checked')) isBoolen = true;
                    }
                });
                $("#" + TreeNodeId).attr("checked", isBoolen);
            }        function CheckSub() {            var TreeNodeId; //父级            var ClickChecked = $(this).attr("checked");            var ClickID = $(this).attr("id").toString();            var ParentTable = $(this).parent().parent().parent().parent().parent().prev(); //父级table  
                
                var DomainTable= $(this).parent().parent().parent().parent().parent().prev().parent().prev(); //得到点击checkbox的域节点所在的tbale
                
                var DomainDiv= $(this).parent().parent().parent().parent().parent().prev().parent();//得到点击该checkbox所在的div集合            var thiDiv = $(this).parent().parent().parent().parent().parent(); //当前选中节点的父节点下面的所有子节点集合               var SubID = ClickID.replace("CheckBox", "Nodes"); //找到该节点下的所有子节点div的ID号            $("#" + SubID).find("input[type='checkbox']").attr("checked", ClickChecked);            var isbool = false;            $(thiDiv).find("input[type='checkbox']").each(function() {                if ($(this).attr('checked'))
                        isbool = true;
                });
                $(ParentTable).find("input[type='checkbox']").attr("checked", isbool);            var isBoolen = false;              $(DomainDiv).find("input[type='checkbox']").each(function(key,val){
                        if ($(this).attr('checked')) isBoolen = true;
                   });
                  $(DomainTable).find("input[type='checkbox']").attr("checked", isBoolen);  //根据子节点选中状态来判断域节点的选中状态
            }[/code]
      

  3.   

    TreeView1.Attributes.Add("onclick", "ReturnValue()");
    function ReturnValue() {
      var objNode = event.srcElement;
      var unitid = event.srcElement.href;
      if (objNode.tagName != "SPAN") {
      return;
      }
     objNode.getAttribute("innerHtml");
    }http://topic.csdn.net/u/20100707/15/4d6ce6db-ea13-4e27-a331-3b08525e3a5b.html