原生js下拉菜单

var oDiv = document.getElementById("sunav");
var oLi = oDiv.getElementsByClassName("sunav");
for(i=0; i<oLi.length; i++){
var aLi = oLi[i];
aLi.onmouseover = function(){
this.getElementsByTagName("ul")[0].style.display = "block";
}
aLi.onmouseout = function(){
this.getElementsByTagName("ul")[0].style.display = "none";
}
}

posted @ 2016-08-31 09:45  简单就好zyx  阅读(912)  评论(0编辑  收藏  举报