function ShoworHidesubmenu(li){ var myli=li.value; var submenu=myli.getElementsByTagName("ul")[0]; if(submenu.style.display=="none") { submenu.style.display = "block"; } else{ submenu.style.display="none"; }}//鼠标移入移出时显示与隐藏二级菜单 window.onload=function(){ var aLi=document.getElementsByTagName('li'); for(var i=0; i<aLi.length; i++){ aLi[i].onmouseover=function(){ var aChild=this.getElementsByTagName("ul")[0]; aChild.className=""; } aLi[i].onmouseout=function(){ var aChild=this.getElementsByTagName("ul")[0]; aChild.className="dropdown-menu"; //.subNav:overflow:hidden } } }//鼠标单击时显示与隐藏二级菜单 window.onload= function () { var oUl=document.getElementById("ul1"); var aLi=oUl.getElementsByTagName("li")[0]; for(var i=0;i<aLi.length;i++){ aLi[i].onclick=function(){// var aChild=this.getElementsByTagName("ul")[0]; var aChild=this.children; if(aChild.className=="dropDown-menu") { aChild.className=""; } else { aChild.className="dropDown-menu"; } } } }window.onload= function () { var menu=document.getElementById("myul"); var cls=menu.getElementsByClassName("dropdown"); menu.onclick=function(e){ var e=e||window.event; var target= e.target || e.srcElement; if(target.className=="dropdown") { if(target.children[0].className=="dropDown-menu"){ target.children[0].className=''; } else { for(var i=0;i<cls.length;i++) { cls[i].children[0].className=''; } target.children[0].className="dropDown-menu"; } } }}
添加回答
举报
0/150
提交
取消