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.