后台菜单html css,CSS+js实现的后台管理菜单

CSS+js实现的后台治理菜单_mb5u.com

body{font-size:12px;}

ul,li,h2{margin:0;padding:0;}

ul{list-style:none;}

#top{width:900px;height:40px;margin:0 auto;background-color:#cc0}

#top h2{width:150px;height:40px;background-color:#9c0;float:left;font-size:14px;text-align:center;line-height:40px;}

#topTags{width:750px;height:40px;margin:0 auto;background-color:#cc0;float:left}

#topTags ul li{float:left;width:100px;height:25px;margin-right:5px;display:block;text-align:center;cursor:pointer;padding-top:15px;}

#main{width:900px;height:500px;margin:0 auto;background-color:#F5F7E6;}

#leftMenu{width:150px;height:500px;background-color:#009900;float:left}

#leftMenu ul{margin:10px;}

#leftMenu ul li{width:130px;height:30px;display:block;background:#9c0;cursor:pointer;line-height:30px;text-align:center;margin-bottom:5px;}

#leftMenu ul li a{color:#000000;text-decoration:none;}

#mrc{width:750px;height:500px;float:left}

.mrc{width:740px;height:490px;display:none;padding:5px;overflow-y:auto;line-height:30px;}

#footer{width:900px;height:30px;margin:0 auto;background-color:#ccc;line-height:30px;text-align:center;}

.mrc1 {width:740px;height:490px;display:block;padding:5px;overflow-y:auto;line-height:30px;}

window.οnlοad=function(){

function $(id){return document.getElementById(id)}

var menu=$("topTags").getElementsByTagName("ul")[0];//顶部菜单容器

var tags=menu.getElementsByTagName("li");//顶部菜单

var ck=$("leftMenu").getElementsByTagName("ul")[0].getElementsByTagName("li");//左侧菜单

var j;

//点击左侧菜单增加新标签

for(i=0;i

ck[i].οnclick=function(){

$("welcome").style.display="none"//欢迎内包庇躲

clearMenu();

this.style.background="yellow";

//循环取得当前索引

for(j=0;j<8;j++){

if(this==ck[j]){

if($("p"+j)==null){

openNew(j,this.innerHTML);//设置标签显示文字

}

clearStyle();

$("p"+j).style.backgroundColor="yellow";

clearContent();

$("c"+j).style.display="block";

}

}

return false;

}

}

//增删标签

function openNew(id,name){

var tagMenu=document.createElement("li");

tagMenu.id="p"+id;

tagMenu.innerHTML=name+" "+"f617abe59953b125fcb3b34c5030c924.gif";

//点击事件

tagMenu.οnclick=function(evt){

clearMenu();

ck[id].style.background="yellow";

clearStyle();

tagMenu.style.backgroundColor="yellow";

clearContent();

$("c"+id).style.display="block";

}

//封闭点击

tagMenu.getElementsByTagName("img")[0].οnclick=function(evt){

evt=(evt)?evt:((window.event)?window.event:null);

if(evt.stopPropagation){evt.stopPropagation()} //取消opera和Safari冒泡行为;

this.parentNode.parentNode.removeChild(tagMenu);//删除当前标签

var color=tagMenu.style.backgroundColor;

//设置假如封闭一个标签时,让最后一个标签得到焦点

if(color=="#ffff00"||color=="yellow"){//区别浏览器对颜色解释

if(tags.length-1>=0){

clearStyle();

tags[tags.length-1].style.backgroundColor="yellow";

clearContent();

var cc=tags[tags.length-1].id.split("p");

$("c"+cc[1]).style.display="block";

clearMenu();

ck[cc[1]].style.background="yellow";

}

else{

clearContent();

clearMenu();

$("welcome").style.display="block"

}

}

}

menu.appendChild(tagMenu);

}

//清除菜单样式

function clearMenu(){

for(i=0;i

ck[i].style.background="#9c0";

}

}

//清除标签样式

function clearStyle(){

for(i=0;i

menu.getElementsByTagName("li")[i].style.backgroundColor="#FFCC00";

}

}

//清除内容

function clearContent(){

for(i=0;i<7;i++){

$("c"+i).style.display="none";

}

}

}

治理菜单

  • 个人资料
  • 相册治理
  • 日志治理
  • 留言治理
  • 软件分类
  • 系统治理
  • 帮助信息

欢迎使用后台治理系统!

个人资料
相册治理
日志治理
留言治理
软件分类
系统治理
帮助信息