var head="display:''"
img_close=new Image()
img_close.src="/sysManage/images/f.gif"
img_open=new Image()
img_open.src="/sysManage/images/fo.gif"
img3=new Image()
img3.src="/sysManage/images/e.gif";
var elment = img_close.src
function onMouseDown(){
if(!document.all)return
var eventObj = event.srcElement;
if(eventObj.tagName=="IMG" ) {
//判断是否存在子节点
var sSrc = eventObj.src ;
if(sSrc == null || sSrc.length<=0)return;
if(sSrc.indexOf("e.gif") >= 0)return;
if(sSrc.indexOf("f")<0 && sSrc.indexOf("tree-site")<0 )return;
var nOffIndex = 2;
var srcIndex = eventObj.sourceIndex;
var nested = document.all[srcIndex + nOffIndex];
if(nested.tagName!="DL"){
nested = document.all[srcIndex + 1];
}
if (nested.style.display=="none") {
nested.style.display='inline';
if(sSrc.indexOf("f.gif")>0)
eventObj.src = img_open.src;
}
else {
nested.style.display="none";
if(sSrc.indexOf("fo.gif")>0)
eventObj.src = img_close.src;
}
}else if(eventObj.tagName == "A" ){//相应节点的点击
var nChnlId = parseInt(eventObj.name);
if(!isNaN(nChnlId)){
onClickChannel(nChnlId);
}
}
}
/** 选中某个节点下的所有子节点(主要用于权限树的选择).
* @param obj 节点选择框对象(checkbox对象)
*根据所选节点的值,遍历整个树,从而选中满足条件的节点.
*/
/*
function checkNode(obj) {
for (var i=0;i
if (form1.chkID[i].value.length > obj.value.length && form1.chkID[i].value.substring(0,obj.value.length) == obj.value)
{
if(obj.checked)
{
form1.chkID[i].checked = true;
}
else
{
form1.chkID[i].checked = false;
}
}
}
}
*/
function checkNode(obj)
{
var elm = obj.parentNode;
checkChildrenRecurve(elm);
//checkRootRecurve(document.getElementById("root"));
}
function checkChildrenRecurve(elm)
{
var dd = elm;
var dl = dd.lastChild;
if (dl.tagName != "DL") return;
var ddlist = dl.children;
for (var i=0;i
ddlist[i].firstChild.checked=elm.firstChild.checked;
checkChildrenRecurve(ddlist[i].firstChild.parentNode)
}
}
function checkRootRecurve(dl)
{
if (dl.tagName != "DD")
{
dl.parentNode.firstChild.firstChild.allChecked = dl.parentNode.firstChild.firstChild.checked;
dl.parentNode.firstChild.firstChild.allUnChecked = !dl.parentNode.firstChild.firstChild.checked;
return;
}
var lis = dl.children;
var allChecked = true;
var allUnChecked = true;
for (var i=0;i
checkRootRecurve(lis[i].lastChild);
allChecked = allChecked && lis[i].firstChild.firstChild.checked && lis[i].firstChild.firstChild.allChecked;
allUnChecked = allUnChecked && !lis[i].firstChild.firstChild.checked && lis[i].firstChild.firstChild.allUnChecked;
}
dl.parentNode.firstChild.firstChild.allChecked=allChecked;
dl.parentNode.firstChild.firstChild.allUnChecked=allUnChecked;
if (allChecked || allUnChecked)
{
dl.parentNode.firstChild.firstChild.checked=allChecked;
dl.parentNode.firstChild.firstChild.disabled=false;
dl.parentNode.firstChild.childStatus=false;
}
else
{
dl.parentNode.firstChild.firstChild.disabled=true;
dl.parentNode.firstChild.childStatus=true;
dl.parentNode.firstChild.firstChild.checked=true;
}
}
document.onclick=onMouseDown
/**
*如果所有子节点都被选中,然么父节点也要选中
*output:无
*/
function selParentNode(nodeIDStr,spltStr){
var nodeLen=nodeIDStr.length;
var nodeList;
if(nodeLen<1){
return;
}
nodeIDList = nodeIDStr.split(spltStr);
for (j=0;j
if(checkSubNode(nodeIDList[j]))
{
for (var k=0;k
if(form1.chkID[k].value == nodeIDList[j] )
{
form1.chkID[k].checked = true;
break;
}
}
}
}
}
/**
* 判断某个节点值下的所有子节点是否被选中(主要用于权限树的选择).
* curNodeID 某个节点的值
*output:true 或 false
**/
function checkSubNode(curNodeID) {
for (var i=0;i
if (form1.chkID[i].value.substring(0,curNodeID.length) == curNodeID && form1.chkID[i].value.length >= (curNodeID.length +2) )
{
if(!form1.chkID[i].checked )
{
return false;
}
}
}
return true;
}
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。