JS Three-level collapsible menu implementation Method _javascript skills

Source: Internet
Author: User
Tags visibility

This article describes the JS three-level collapsible menu implementation method. Share to everyone for your reference, specific as follows:

. ASPX code:

<%@ Page language= "C #" autoeventwireup= "true" codefile= "NavigateMenu.aspx.cs" inherits= "Navigatemenu"%> <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
  ">  

JS File code:

function Domenu (obj,strdeep) {
 var items=obj.parentnode.getelementsbytagname ("ul");
 Get a object with all the UL sets contained in your node Li
 var itmul;
 var deeps=strdeep; Strdeep is the series
 if (items.length>0) {
 itmul=items[0] of the current menu;
 alert (Itmul);
 }
 if (itmul.classname!= "ex") {
 cxall ()//When the current node is off, perform the shutdown All UL submenu
 if (deeps== ' 2 ') {//To expand the Level three menu, expand its level two parent menu
 itmul.parentnode.parentnode.classname= "ex";
 }
 Itmul.classname= "Ex"; Expand Downlevel Menu
 }else{
 itmul.classname= "CX";
 }
function Statup () {
 cxall ();
 var Uldom=document.getelementbyid ("Nav");
 var items=uldom.getelementsbytagname ("ul");
}
function Cxall () {
 var Uldom=document.getelementbyid ("Nav");
 var items=uldom.getelementsbytagname ("ul");
 for (Var i=0;i<items.length;i++)
 {
 items[i].classname= "CX";
 }
}

More readers interested in JavaScript-related content can view the site topics: "JavaScript Search Algorithm Skills Summary", "JavaScript animation effects and Skills summary", "JavaScript Error and debugging skills summary", " JavaScript data structure and algorithm skills summary, "javascript traversal algorithm and Skills summary" and "JavaScript Mathematical Computing Usage Summary"

I hope this article will help you with your JavaScript programming.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.