function OnTreeNodeChecked() {
            var ele = event.srcElement;
            if (ele.type == 'checkbox') {
                var divId = ele.id.replace('CheckBox', 'Nodes');
                $("#" + divId).find("input[type=checkbox]").attr("checked", ele.checked);
                OnTreeNodeChildChecked(ele);

            }
        }

        function OnTreeNodeChildChecked(ele) {
            //自动处理上级
            try {
                var parentDiv = $(ele).parent().parent().parent().parent().parent();
                //  ele.parentElement.parentElement.parentElement.parentElement.parentElement;
                if (typeof (parentDiv.attr('id')) == 'undefined')
                    return;
                var parentChkBox = document.getElementById(parentDiv.attr('id').replace('Nodes', 'CheckBox'));
                if (parentChkBox != null) {
                    var ChildsChkAll = true;
//                    var Boxs = parentDiv.getElementsByTagName('INPUT');
//                    for (var i = 0; i < Boxs.length; i++) {
//                        if (Boxs[i].type == 'checkbox' && Boxs[i].checked == false) {
//                            ChildsChkAll = false;
//                        }
//                    }
                    parentChkBox.checked = ChildsChkAll;
                    OnTreeNodeChildChecked(parentChkBox);
                }
            }
            catch (e) {
                alert(e.message);
            }
        }

posted on 2012-09-11 17:06 sanmao 阅读(708) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
 

常用链接

留言簿(5)

随笔分类

随笔档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜