Home > Web Front-end > JS Tutorial > body text

Simple collapsible two-level tree menu made with JS_javascript skills

WBOY
Release: 2016-05-16 17:22:21
Original
1010 people have browsed it
复制代码 代码如下:





可折叠的两级菜单




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







  • Related labels:
    source:php.cn
    Previous article:js prompt box with button for selection sample code_javascript skills Next article:4 ways to write JS code for what day of the week today is_javascript skills
    Statement of this Website
    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
    Latest Articles by Author
    Latest Issues
    Related Topics
    More>
    Popular Recommendations
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!