教我做一个asp菜单
这是JS实现的。
有很多蓝色理想论坛。你可以只搜索JS导航。
下面我给你贴一张
===================
& ltstyle & gt
#mch{
宽度:760px
边距:0自动;
文本对齐:居中;
}
#mch ul {
填充:0;
边距:0;
列表样式:无;
}
#mch李{
列表样式:无;
浮动:左;
边距:0自动;
填充:0;
行高:16px;
}
#mch li div{}
#mch li ul {
位置:相对;
显示:无;
}
#mch li:悬停#mch ul,#mch li.over ul {
显示:块;
}
# mch Li . over { background:# aae;}
#阿利妇幼保健公司{
显示:块;
font-size:12px;
填充:3px 0 0
宽度:76px
文字-装饰:无;
颜色:# 777;
}
#mch ul阿利:盘旋{
背景色:# f4f4f4
}
#mch。阿利解放运动
浮动:左;
显示:块;
宽度:自动;
保证金:4px 0 0
填充:2px 4px 0 4px
文本对齐:居中;
文字-装饰:无;
颜色:# 000;
}
#mch。库a:悬停{
文字-装饰:无;
颜色:# ff2200
}
#mch ul。lib ul li
位置:绝对;
浮动:左;
填充:0;
边距:0;
高度:26px
top:0;左:0;
宽度:760px
背景:# ffd
}
#mch。自由阿利党
显示:块;
font-size:12px;
填充:4px 3px
边距-右边:1px;
文字-装饰:无;
颜色:# 777;
}
#mch。lib阿利:hover {背景:# eee}
& lt/style & gt;
& ltbody & gt
& ltdiv id="mch " >& lt/div & gt;
& lt脚本& gt
var m _ path = "/" & gt;新浪
& lt/ul & gt;';
document.getElementById('mch ')。innerHTML = navdata
var dfr,dfrover,thsobj,thsobjover
if(type of(dPu)= = " undefined ")var dPu = document . location . pathname . replace(/(。*\/){0,}([^\.]+).*/ig," $ 2 ");
if(dPu = = " " | | dPu = = "/")dPu = " default ";
函数开始列表(dg) {
if (document.getElementById) {
var nav root = document . getelementbyid(" nav ");
for(I = 0;我& ltnav root . child nodes . length;i++) {
node = nav root . child nodes[I];
if (node.nodeName=="LI") {
var nA = node . getelementsbytagname(' a ');
node . getelementsbytagname(' Li ')[0]. style . left =-I * 76+" px ";
nA[0]. style . background = " # eee ";
node . class name = node . class name . replace(" over "," ");
if((DG = = 0 | | DG = = 3)& amp;& ampnode.parentNode==navRoot){
node.onmouseover=function() {
thsobjover = this
clear time out(DFR);
DFR over = setTimeout(" startList(1);thsobjover . class name+= ' over ';thsobjover . getelementsbytagname(' a ')[0]. style . background = ' # ffd ';",200);
}
node.onmouseout=function() {
thsobj = this
clear time out(DFR over);
DFR = setTimeout(" ths obj . getelementsbytagname(' a ')[0]. style . background = ' # eee ');ths obj . class name = ths obj . class name . replace(' over ',' ');startList(2);",2000);
}
}
if(dg==1||dg==3)继续;
for(j = 0;j & ltnA .长度;j++){
if(nA[j].pathname.replace(/(。*\/){0,}([^\.]+).*/ig," $2")==dPu){
node . class name+= " over ";
nA[0]. style . background = " # ffd ";
nA[0]. style . font weight = " 800 ";
if(j & gt;0)nA[j]. style . background = " # fe9 ";
那[j]。onclick = function(){ this . blur();返回false}
DG = 3;打破;
}
}
}
}
}
}
startList(0);
& lt/script & gt;
& lt/body & gt;