farmhouse
BlogJava
首頁
新隨筆
聯系
聚合
管理
隨筆-1 評論-4 文章-15 trackbacks-0
一個很不錯的,代碼簡單的后臺管理界面
div+css+js=效果
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>無標題文檔</title> <style type="text/css"> 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:#CCCC00} #top h2{width:150px;height:40px;background-color:#99CC00;float:left;font-size:14px;text-align:center;line-height:40px;} #topTags{width:750px;height:40px;margin:0 auto;background-color:#CCCC00;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:#99CC00;cursor:pointer;line-height:30px;text-align:center;margin-bottom:5px;} #leftMenu ul li a{color:#000000;text-decoration:none;} #content{width:750px;height:500px;float:left} .content{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;} .content1 {width:740px;height:490px;display:block;padding:5px;overflow-y:auto;line-height:30px;} </style> <script type="text/javascript"> window.onload=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.length;i++){ ck[i].onclick=function(){ $("welcome").style.display="none"http://歡迎內容隱藏 //循環取得當前索引 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+" "+"<img src='http://www.tjdadi.com.cn/off.gif' style='vertical-align:middle'/>"; //標簽點擊事件 tagMenu.onclick=function(evt){ clearStyle(); tagMenu.style.backgroundColor="yellow"; clearContent(); $("c"+id).style.display="block"; } //標簽內關閉圖片點擊事件 tagMenu.getElementsByTagName("img")[0].onclick=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"; } else{ clearContent(); $("welcome").style.display="block" } } } menu.appendChild(tagMenu); } //清除標簽樣式 function clearStyle(){ for(i=0;i<tags.length;i++){ menu.getElementsByTagName("li")[i].style.backgroundColor="#FFCC00"; } } //清除內容 function clearContent(){ for(i=0;i<7;i++){ $("c"+i).style.display="none"; } } } </script> </head> <body> <div id="top"> <h2>管理菜單</h2> <div id="topTags"> <ul> </ul> </div> </div> <div id="main"> <div id="leftMenu"> <ul> <li>個人資料</li> <li>相冊管理</li> <li>日志管理</li> <li>留言管理</li> <li>風格管理</li> <li>系統管理</li> <li>幫助信息</li> </ul> </div> <div id="content"> <div id="welcome" class="content" style="display:block;"> <div align="center"> <p> </p> <p><strong>歡迎使用用戶管理系統!</strong></p> <p> </p> </div> </div> <div id="c0" class="content">個人資料</div> <div id="c1" class="content">相冊管理</div> <div id="c2" class="content">日志管理</div> <div id="c3" class="content">留言管理</div> <div id="c4" class="content">風格管理</div> <div id="c5" class="content">系統管理</div> <div id="c6" class="content">幫助信息</div> </div> </div> <div id="footer">copyright for lalasxc </div> </body> </html>
提示:您可以先修改部分代碼再運行
posted on 2008-05-26 15:40
farmer
閱讀(318)
評論(0)
編輯
收藏
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
斯是陋室,惟吾德馨
歡迎訪問:
茅草窩
<
2025年8月
>
日
一
二
三
四
五
六
27
28
29
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
常用鏈接
我的隨筆
我的文章
我的評論
我的參與
最新評論
留言簿
(1)
給我留言
查看公開留言
查看私人留言
隨筆檔案
2008年3月 (1)
文章檔案
2010年7月 (2)
2010年4月 (1)
2009年10月 (1)
2009年6月 (1)
2008年9月 (1)
2008年8月 (1)
2008年5月 (8)
Friend Link
茅草窩
搜索
積分與排名
積分 - 4321
排名 - 3241
最新評論
1.?re: 城市、日歷選擇,含輸入提示功能,非常酷的效果
很好的js效果,支持一下,看完有問題再請教樓主
--北夜人
2.?re: C#操作Excel文件
這個函數在那個庫中,按要求添加庫了,怎么解決
--kylexy
3.?re: C#操作Excel文件
評論內容較長,點擊標題查看
--kylexy
4.?re: 獲取SQL所有數據庫名、所有表名、所有字段名[未登錄]
yes thank you
--frist
Powered by:
博客園
模板提供:
滬江博客
Copyright ©2025 farmer
主站蜘蛛池模板:
固安县
|
公安县
|
会东县
|
五大连池市
|
平南县
|
石狮市
|
红河县
|
卓资县
|
泸定县
|
遵义市
|
正蓝旗
|
巴林右旗
|
西充县
|
高台县
|
和田市
|
峨边
|
克东县
|
闸北区
|
奉贤区
|
河北区
|
青海省
|
东兰县
|
枣庄市
|
屏边
|
西充县
|
太湖县
|
敦煌市
|
信丰县
|
体育
|
商城县
|
曲沃县
|
威远县
|
北京市
|
庆云县
|
泽州县
|
阿鲁科尔沁旗
|
湘潭市
|
兴海县
|
华阴市
|
乌恰县
|
酒泉市
|