在蓝色看到一个后台管理的框架--绝对是好东西

 

  1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2 <html xmlns="http://www.w3.org/1999/xhtml">
  3 <head>
  4 <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  5 <title>无标题文档</title>
  6 <style type="text/css">
  7 body{font-size:12px;}
  8 ul,li,h2{margin:0;padding:0;}
  9 ul{list-style:none;}
 10 #top{width:900px;height:40px;margin:0 auto;background-color:#CCCC00}
 11 #top h2{width:150px;height:40px;background-color:#99CC00;float:left;font-size:14px;text-align:center;line-height:40px;}
 12 #topTags{width:750px;height:40px;margin:0 auto;background-color:#CCCC00;float:left}
 13 #topTags ul li{float:left;width:100px;height:25px;margin-right:5px;display:block;text-align:center;cursor:pointer;padding-top:15px;}
 14 #main{width:900px;height:500px;margin:0 auto;background-color:#F5F7E6;}
 15 #leftMenu{width:150px;height:500px;background-color:#009900;float:left}
 16 #leftMenu ul{margin:10px;}
 17 #leftMenu ul li{width:130px;height:30px;display:block;background:#99CC00;cursor:pointer;line-height:30px;text-align:center;margin-bottom:5px;}
 18 #leftMenu ul li a{color:#000000;text-decoration:none;}
 19 #content{width:750px;height:500px;float:left}
 20 .content{width:740px;height:490px;display:none;padding:5px;overflow-y:auto;line-height:30px;}
 21 #footer{width:900px;height:30px;margin:0 auto;background-color:#ccc;line-height:30px;text-align:center;}
 22 .content1 {width:740px;height:490px;display:block;padding:5px;overflow-y:auto;line-height:30px;}
 23 </style>
 24 <script type="text/javascript">
 25 window.onload=function(){
 26 function $(id){return document.getElementById(id)}
 27 var menu=$("topTags").getElementsByTagName("ul")[0];//顶部菜单容器
 28 var tags=menu.getElementsByTagName("li");//顶部菜单
 29 var ck=$("leftMenu").getElementsByTagName("ul")[0].getElementsByTagName("li");//左侧菜单
 30 var j;
 31 //点击左侧菜单增加新标签
 32 for(i=0;i<ck.length;i++){
 33 ck[i].onclick=function(){
 34 $("welcome").style.display="none"//欢迎内容隐藏
 35 clearMenu();
 36 this.style.background="yellow";
 37 //循环取得当前索引
 38 for(j=0;j<8;j++){
 39 if(this==ck[j]){
 40 if($("p"+j)==null){
 41 openNew(j,this.innerHTML);//设置标签显示文字
 42  }
 43 clearStyle();
 44 $("p"+j).style.backgroundColor="yellow";
 45 clearContent();
 46 $("c"+j).style.display="block";
 47    }
 48  }
 49 return false;
 50   }
 51  }
 52 //增加或删除标签
 53 function openNew(id,name){
 54 var tagMenu=document.createElement("li");
 55 tagMenu.id="p"+id;
 56 tagMenu.innerHTML=name+"&nbsp;&nbsp;&nbsp;"+"<img src='http://www.tjdadi.com.cn/off.gif' style='vertical-align:middle'/>";
 57 //标签点击事件
 58 tagMenu.onclick=function(evt){
 59 clearMenu();
 60 ck[id].style.background="yellow";
 61 clearStyle();
 62 tagMenu.style.backgroundColor="yellow";
 63 clearContent();
 64 $("c"+id).style.display="block";
 65 }
 66 //标签内关闭图片点击事件
 67 tagMenu.getElementsByTagName("img")[0].onclick=function(evt){
 68 evt=(evt)?evt:((window.event)?window.event:null);
 69 if(evt.stopPropagation){evt.stopPropagation()} //取消opera和Safari冒泡行为;
 70 this.parentNode.parentNode.removeChild(tagMenu);//删除当前标签
 71 var color=tagMenu.style.backgroundColor;
 72 //设置如果关闭一个标签时,让最后一个标签得到焦点
 73 if(color=="#ffff00"||color=="yellow"){//区别浏览器对颜色解释
 74 if(tags.length-1>=0){
 75 clearStyle();
 76 tags[tags.length-1].style.backgroundColor="yellow";
 77 clearContent();
 78 var cc=tags[tags.length-1].id.split("p");
 79 $("c"+cc[1]).style.display="block";
 80 clearMenu();
 81 ck[cc[1]].style.background="yellow";
 82  }
 83 else{
 84 clearContent();
 85 clearMenu();
 86 $("welcome").style.display="block"
 87    }
 88   }
 89 }
 90 menu.appendChild(tagMenu);
 91 }
 92 //清除菜单样式
 93 function clearMenu(){
 94 for(i=0;i<ck.length;i++){
 95 ck[i].style.background="#99CC00";
 96  }
 97 }
 98 //清除标签样式
 99 function clearStyle(){
100 for(i=0;i<tags.length;i++){
101 menu.getElementsByTagName("li")[i].style.backgroundColor="#FFCC00";
102   }
103 }
104 //清除内容
105 function clearContent(){
106 for(i=0;i<7;i++){
107 $("c"+i).style.display="none";
108  }
109 }
110 }
111 </script>
112 </head>
113 <body>
114 <div id="top">
115 <h2>管理菜单</h2>
116 <div id="topTags">
117 <ul>
118 
119 </ul>
120 </div>
121 </div>
122 <div id="main"> 
123 <div id="leftMenu">
124 <ul>
125 <li>个人资料</li>
126 <li>相册管理</li>
127 <li>日志管理</li>
128 <li>留言管理</li>
129 <li>风格管理</li>
130 <li>系统管理</li>
131 
132 <li>帮助信息</li>
133 </ul>
134 </div>
135 <div id="content">
136 <div id="welcome" class="content" style="display:block;">
137   <div align="center">
138     <p>&nbsp;</p>
139     <p><strong>欢迎使用用户管理系统!</strong></p>
140     <p>&nbsp;</p>
141     </div>
142 
143 </div>
144 <div id="c0" class="content">个人资料</div>
145 <div id="c1" class="content">相册管理</div>
146 <div id="c2" class="content">日志管理</div>
147 <div id="c3" class="content">留言管理</div>
148 <div id="c4" class="content">风格管理</div>
149 <div id="c5" class="content">系统管理</div>
150 <div id="c6" class="content">帮助信息</div>
151 </div>
152 </div>
153 
154 <div id="footer">copyright for lalasxc </div>
155 </body>
156 </html>

 

 

 

 

演示地址:http://textsnip.com/6bb997/html


感觉这个做个后台管理框架非常好。

 

转载自:http://hi.baidu.com/function/blog/item/6b3c0a461afde80c6a63e5bb.html

posted @ 2010-01-20 01:25  过世许久  阅读(532)  评论(0编辑  收藏  举报