Home  >  Article  >  Web Front-end  >  Simple collapsible two-level tree menu made with JS_javascript skills

Simple collapsible two-level tree menu made with JS_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:22:211043browse
复制代码 代码如下:





可折叠的两级菜单




window.onload=function(){
varlistUL=document.getElementById("listUL");
varolist=listUL.childNodes;
varoa=0;
for(var i = 0; i < olist.length; i ) {
if(olist[i].tagName=="LI"&&olist[i].getElementsByTagName("ul")[0]){
oa=olist[i];
oa.onclick=change;
}

}
functionchange(){
varos=this.getElementsByTagName("ul")[0];
if(os.className=="myHide")
os.className="myShow";
else
os.className="myHide";
}
}






  • Home



  • news


  • lastest news

  • all news




  • sports


  • lastest news

  • all news




  • weather


  • lastest news

  • all news







  • Statement:
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Previous article:js prompt box with button for selection sample code_javascript skillsNext article:js prompt box with button for selection sample code_javascript skills

    Related articles

    See more