html折叠菜单mysql_比较棒的后台管理折叠菜单

后台管理

body {margin:0;text-align:center;color:#000;font:normal 12px Arial,Verdana,Tahoma;text-align:center;background:#C8D0D5;line-height:150%;}

a:link,a:visited {color:#385065;text-decoration:none}

a:hover {text-decoration:underline}

#menu {width:150px;margin:0px 15px;padding:0px;text-align:left;list-style:none}

#menu .item {margin:5px 0px;padding:0px;list-style:none}

a.title:link, a.title:visited, a.title:hover {display:block;background:url(http://bbs.blueidea.com/attachments/2006/11/17/m20069110491_ElLVUNZUyGH3.gif) no-repeat;color:#385065;font-weight:bold;padding:2px 0 0 22px;width:128px;line-height:23px;cursor:pointer;text-decoration:none}

#menu .item ul {border:1px solid #9FACB7;margin:0;width:118px;padding:3px 0px 3px 30px;background:#fff;list-style:none;display:none}

#menu .item ul li {display:block;}

// --- 获取ClassName

document.getElementsByClassName = function(cl) {

var retnode = [];

var myclass = new RegExp('\\b'+cl+'\\b');

var elem = this.getElementsByTagName('*');

for (var j = 0; j < elem.length; j++) {

var classes = elem[j].className;

if (myclass.test(classes)) retnode.push(elem[j]);

}

return retnode;

}

// --- 隐藏所有

function HideAll() {

var items = document.getElementsByClassName("optiton");

for (var j=0; j

items[j].style.display = "none";

}

}

// --- 设置cookie

function setCookie(sName,sValue,expireHours) {

var cookieString = sName + "=" + escape(sValue);

//;判断是否设置过期时间

if (expireHours>0) {

var date = new Date();

date.setTime(date.getTime + expireHours * 3600 * 1000);

cookieString = cookieString + "; expire=" + date.toGMTString();

}

document.cookie = cookieString;

}

//--- 获取cookie

function getCookie(sName) {

var aCookie = document.cookie.split("; ");

for (var j=0; j < aCookie.length; j++){

var aCrumb = aCookie[j].split("=");

if (escape(sName) == aCrumb[0])

return unescape(aCrumb[1]);

}

return null;

}

window.onload = function() {

var show_item = "opt_1";

if (getCookie("show_item") != null) {

show_item= "opt_" + getCookie("show_item");

}

document.getElementById(show_item).style.display = "block";

var items = document.getElementsByClassName("title");

for (var j=0; j

items[j].onclick = function() {

var o = document.getElementById("opt_" + this.name);

if (o.style.display != "block") {

HideAll();

o.style.display = "block";

setCookie("show_item",this.name);

}

else {

o.style.display = "none";

}

}

}

}

基本信息 系统管理 系统管理
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值