javascript css實(shí)現(xiàn)三級(jí)目錄(簡(jiǎn)單的)
是在原先的二級(jí)目錄改的,先給出演示
這里是css
/*bg macji(http://www.macji.com)*/
ul,li,p{margin:0; padding:0; list-style:none; font-size:12px}
.m_menu_title{height:24px;line-height:24px;text-align:center;margin:0 1px}
.m_menu_content{border-top:solid 1px #ccc;padding:8px 2px}
/*一級(jí)*/
.m_menu_content p{height:22px;line-height:22px}
.m_menu_content p a{
color:#666633;
font-weight:bold;
text-decoration:none;
background:url(http://www.macji.com/blog/img/icon.gif) no-repeat 8px 4px;
padding:0 0 0 30px;
display:block
}
.m_menu_content p a:hover{color:#fe8005;font-weight:bold;text-decoration:none}
.m_menu_content p a.on{background-position:8px -18px}
/*二級(jí)*/
.menu2{}
.menu2 li{line-height:22px}
.menu2 a{color:#000;
text-decoration:none;
display:block;
padding:0 0 0 40px;
background:url(http://www.macji.com/blog/img/icon.gif) no-repeat 18px 4px
}
.menu2 a.on{background-position:18px -18px}
/*三級(jí)*/
.menu2 ul{}
.menu2 ul a{
background-position:30px -39px;
padding:0 0 0 50px;
color:#666633;
text-decoration:underline
}
.menu2 ul a:hover{background-color:#f5f5f5; color:#f60}
目錄是循環(huán)的,我給寫(xiě)死了.下面給出js
/*
這里是直接寫(xiě)死了,根據(jù)傳入的id編號(hào),判斷是否顯示,不顯示就顯示
id編號(hào)是有規(guī)律的,可用服務(wù)器端語(yǔ)言循環(huán)出目錄
*/
function setMenuList(num){
var p = document.getElementById('p' + num);
var ul = document.getElementById('ul' + num);
if(ul.style.display == ‘none'){
ul.style.display = ”;
p.className = “on”;
}else{
ul.style.display = ‘none';
p.className = “”;
}
}
演示查看
[Ctrl+A 全選 注:引入外部Js需再刷新一下頁(yè)面才能執(zhí)行]
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
asp中用數(shù)據(jù)庫(kù)生成不重復(fù)的流水號(hào)
asp中用數(shù)據(jù)庫(kù)生成不重復(fù)的流水號(hào)的實(shí)現(xiàn)代碼,需要的朋友可以參考下實(shí)現(xiàn)原理其它程序一樣。2006-09-09
asp 實(shí)現(xiàn)檢測(cè)字符串是否為純字母和數(shù)字組合的函數(shù)
asp 實(shí)現(xiàn)檢測(cè)字符串是否為純字母和數(shù)字組合的函數(shù)...2007-08-08
64位win7的IIS7下asp與access的連接問(wèn)題
運(yùn)行asp是提示Microsoft OLE DB Provider for ODBC Drivers (0x80004005)[Microsoft][ODBC Microsoft Access Driver] 找不到文件 '(未知的)'。2009-12-12
對(duì)于ASP編碼問(wèn)題的深入研究與最終解決方案
對(duì)于ASP編碼問(wèn)題的深入研究與最終解決方案...2007-05-05
關(guān)于ASP生成偽參數(shù)技巧 簡(jiǎn)潔實(shí)用的偽(僞)參數(shù)
關(guān)于ASP生成偽參數(shù)技巧 簡(jiǎn)潔實(shí)用的偽(僞)參數(shù)...2007-11-11
通過(guò)Response.Flush()實(shí)現(xiàn)下載失敗的解決方法
Response.Flush()實(shí)現(xiàn)對(duì)服務(wù)端文件的下載時(shí),會(huì)失敗,不能正常彈出IE下載框,通過(guò)測(cè)試發(fā)現(xiàn)時(shí)瀏覽器的安全設(shè)置問(wèn)題,如下操作便可解決2013-08-08
asp實(shí)現(xiàn)限制一個(gè)ip只能訪問(wèn)一次的方法
這篇文章主要介紹了asp實(shí)現(xiàn)限制一個(gè)ip只能訪問(wèn)一次的方法,感興趣的小伙伴們可以參考一下2015-10-10

