您好,登錄后才能下訂單哦!
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" ) {
//判斷是否存在子節(jié)點(diǎn)
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" ){//相應(yīng)節(jié)點(diǎn)的點(diǎn)擊
var nChnlId = parseInt(eventObj.name);
if(!isNaN(nChnlId)){
onClickChannel(nChnlId);
}
}
}
/** 選中某個(gè)節(jié)點(diǎn)下的所有子節(jié)點(diǎn)(主要用于權(quán)限樹(shù)的選擇).
* @param obj 節(jié)點(diǎn)選擇框?qū)ο?checkbox對(duì)象)
*根據(jù)所選節(jié)點(diǎn)的值,遍歷整個(gè)樹(shù),從而選中滿足條件的節(jié)點(diǎn).
*/
/*
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
/**
*如果所有子節(jié)點(diǎn)都被選中,然么父節(jié)點(diǎn)也要選中
*output:無(wú)
*/
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;
}
}
}
}
}
/**
* 判斷某個(gè)節(jié)點(diǎn)值下的所有子節(jié)點(diǎn)是否被選中(主要用于權(quán)限樹(shù)的選擇).
* curNodeID 某個(gè)節(jié)點(diǎn)的值
*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;
}
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。