;(function(window){
var li = document.getElementById('parentnav').getElementsByTagName('li')[1];
var li_a = li.getElementsByTagName('a')[0];
var subnav = document.getElementById('subnav');
if (document.addEventListener) {
li.addEventListener('mouseover',function(){
li_a.style.background = '#42358d';
subnav.style.display = 'block';
},false);
li.addEventListener('mouseout',function(){
li_a.style.background = 'transparent';
subnav.style.display = 'none';
},false);
} else if(document.attachEvent) {
li.attachEvent('onmouseover',function(){
li_a.style.background = '#42358d';
subnav.style.display = 'block';
});
li.attachEvent('onmouseout',function(){
li_a.style.background = 'transparent';
subnav.style.display = 'none';
});
} else{
li['onmouseover'] = function(){
li_a.style.background = '#42358d';
subnav.style.display = 'block';
}
li['onmouseout'] = function(){
li_a.style.background = 'transparent';
subnav.style.display = 'none';
}
}
})(window);
兼容IE6及以上的导航栏子菜单栏滑过显示隐藏效果
最新推荐文章于 2021-07-08 16:23:07 发布