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

来源:互联网 发布:火焰喷射器升级数据 编辑:程序博客网 时间:2024/05/01 02:10

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


图1-1



1-2



1-3





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();
}


};
0 0
原创粉丝点击