html5下拉列表多行显示不出来,为什么我这个代码的效果显示不出来?我要显示的是鼠标经过选项出现下拉菜单栏!求大神提点!!!...
* { margin: 0; padding: 0; font-size: 14px; }
a { color: #333; text-decoration: none }
ul{ list-style: none; }
.nav {height: 30px; border-bottom: 5px solid #F60; margin-left:50px; width:600px;}
.nav li { float: left; position:relative; height:30px; width:120px }
.nav li a { display: block; height: 30px; text-align: center; line-height: 30px; width:120px; background: #efefef; margin-left: 1px; }
.subNav{ position:absolute; top:30px; left:0; width:120px; height:0; overflow:hidden}
.subNav li a{ background:#ddd }
.subNav li a:hover{ background:#efefef}
/*
window.οnlοad=function(){
var aLi=document.getElementsByTagName('li');
for(var i=0; i
aLi[i].οnmοuseοver=function(){
//鼠標經過一級菜單,二級菜單動畫下拉顯示出來
var This=this.getElementsByTagName('ul')[0];
clearInterval(This.time);
This.time=setInterval(function(){
This.style.height=This.offsetHeight+16+"px";
if(This.offsetHeight>=120){
clearInterval(This.time);
}
},30)
}
//鼠標離開菜單,二級菜單動畫收縮起來。
aLi[i].οnmοuseοut=function(){
var This=this.getElementsByTagName('ul')[0];
clearInterval(This.time);
This.time = setInterval(function(){
This.style.height=This.offsetHeight-16+"px";
if(This.offsetHeight<=0){
clearInterval(This.time);
}
},30)
}
}
}
*/
window.οnlοad=function(){
var aLi=document.getElementsByTagName("li");
for(var i=0;i
aLi[i].οnmοuseοver=function(){
//鼠標經過一級菜單,二級菜單動畫下拉顯示出來
var aUl=aLi[i].getElementsByTagName("ul")[0];
aUl.style.display="block";
}
aLi[i].οnmοuseοut=function(){
//鼠標離開菜單,二級菜單動畫收縮起來
var aUl=aLi[i].getElementsByTagName("ul")[0];
aUl.style.display="none";
}
}
}
一級菜單- 二級菜單
- 二級菜單
- 二級菜單
- 二級菜單
- 二級菜單
- 二級菜單
- 二級菜單
- 二級菜單
總結
以上是生活随笔為你收集整理的html5下拉列表多行显示不出来,为什么我这个代码的效果显示不出来?我要显示的是鼠标经过选项出现下拉菜单栏!求大神提点!!!...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CAD自控lisp_基于AutoLisp
- 下一篇: Qt关于Tcp通信步骤的总结