相思资源网 Design By www.200059.com

复制代码 代码如下:
// JScript 文件
function getParentByTagName(element,tagName)
{
var parent = element.parentNode;
var upperTagName = tagName.toUpperCase();
while (parent && (parent.tagName.toUpperCase() != upperTagName))
{
parent = parent.parentNode ? parent.parentNode : parent.parentElement;
}
return parent;
}
function setParentChecked(objNode)
{
var objParentDiv = getParentByTagName(objNode,"div");
if(objParentDiv == null || objParentDiv == "undefined")
return;
var objID = objParentDiv.getAttribute("ID");
var objParentCheckBox = document.getElementById(objID.replace("Nodes","CheckBox"));
if(objParentCheckBox == null || objParentCheckBox == "undefined")
return;
if(objParentCheckBox.tagName!="INPUT" && objParentCheckBox.type == "checkbox")
return;
//add
// if (objNode.checked=false) objPraentCheckBox.checked=false;
// objParentCheckBox.checked = true;
setParentChecked(objParentCheckBox);
}
function setParentUnChecked(objNode)
{
var objParentDiv = getParentByTagName(objNode,"div");
if(objParentDiv == null || objParentDiv == "undefined")
return;
var objID = objParentDiv.getAttribute("ID");
var objParentCheckBox = document.getElementById(objID.replace("Nodes","CheckBox"));
if(objParentCheckBox == null || objParentCheckBox == "undefined")
return;
if(objParentCheckBox.tagName!="INPUT" && objParentCheckBox.type == "checkbox")
return;
//add
// if (objNode.checked=false) objPraentCheckBox.checked=false;
objParentCheckBox.checked = false;
setParentUnChecked(objParentCheckBox);
}
function setChildCheckedState(div,state)
{
var objchild = div.childNodes;
var count = objchild.length;
for(var i=0;i<objchild.length;i++)
{
var tempObj = objchild[i];
if(tempObj.tagName=="INPUT" && tempObj.type == "checkbox")
{
tempObj.checked = state;
}
// debugger;
setChildCheckedState(tempObj,state);
}
}
function TreeNodeChecked()
{
var objNode = window.event.srcElement;
if(objNode.tagName!="INPUT" || objNode.type!="checkbox")
return;
// debugger;
if(objNode.checked == true)
{
setParentChecked(objNode);
}
else
{
setParentUnChecked(objNode);
}
var objID = objNode.getAttribute("ID");
var objParentDiv = document.getElementById(objID.replace("CheckBox","Nodes"));
if(objParentDiv==null || typeof(objParentDiv) == "undefined")
return;
setChildCheckedState(objParentDiv,objNode.checked);
}
function SetTreeNodeChecked(objNode1)
{
var objNode =objNode1;
var objID = objNode.getAttribute("ID");
var objParentDiv = document.getElementById(objID.replace("CheckBox","Nodes"));
if(objParentDiv==null || typeof(objParentDiv) == "undefined")
return;
setChildCheckedState(objParentDiv,objNode.checked);
}
function GetYHQS(id)
{
PageMethods.CallYHQX(id,callsuccessed);
}
function callsuccessed(result)
{
// //循环页面
//debugger;
for (i=0;i<document.form1.length ;i++)
{
var objNode=document.form1.elements[i];
if (objNode.tagName=="INPUT" && objNode.type=="checkbox")
{
objNode.checked=false;
}
}
for (i=0;i<document.form1.length ;i++)
{
var objNode=document.form1.elements[i];
if (objNode.tagName=="INPUT" && objNode.type=="checkbox")
{
//找到
//比较
if (result.indexOf(objNode.title)!=-1)
{
objNode.checked=true;
SetTreeNodeChecked(objNode);
}
}
}
}
function test()
{
debugger;
//循环页面
for (i=0;i<document.form1.length ;i++)
{
var objNode=document.form1.elements[i];
if (objNode.tagName=="INPUT" && objNode.type=="checkbox")
{
//找到
//比较
objNode.checked=true;
}
}
}

标签:
js,权限树,更新权限,全选

相思资源网 Design By www.200059.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
相思资源网 Design By www.200059.com

评论“js实现权限树的更新权限时的全选全消功能”

暂无js实现权限树的更新权限时的全选全消功能的评论...