欢迎加入技术交流QQ群80669150 (附加信息:珠海 -"Lzw )一起学习 !




图1-1




dtree.js菜单列表加密,实现Code_js




图1-2


dtree.js菜单列表加密,实现Code_js_02




图1-3

dtree.js菜单列表加密,实现Code_赋值_03




Code:


在dtree.js中找到dtree.prototype.o= ......... 然后进行修改


// Toggle Open or close

var PassWord="";    //定义密码变量,在登陆后赋值给当前变量


dTree.prototype.o = function(id) {


var cn = this.aNodes[id];



//指定某菜单需要加密;如果全部加密,只需要把此层判断去除。


if(id==7)


{


   if(!cn._io)


        {


            var val=window.prompt("密码:","请输入密码...");

//记录用户输入的值


            if(val==PassWord)

//匹配成功,展开菜单


            {


           this.nodeStatus(!cn._io, id, cn._ls);


           cn._io = !cn._io;


           if (this.config.closeSameLevel) this.closeLevel(cn);


           if (this.config.useCookies) this.updateCookie();


       }


        }


        else


        {


       this.nodeStatus(!cn._io, id, cn._ls);


       cn._io = !cn._io;


       if (this.config.closeSameLevel) this.closeLevel(cn);


       if (this.config.useCookies) this.updateCookie();


        }


}


else


{


   this.nodeStatus(!cn._io, id, cn._ls);




   cn._io = !cn._io;




   if (this.config.closeSameLevel) this.closeLevel(cn);




   if (this.config.useCookies) this.updateCookie();


}




};