您好,登錄后才能下訂單哦!
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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。