Javascript+css _javascript technique of collapsible level two menu instance implementation

Source: Internet
Author: User
Tags visibility

This example describes the JAVASCRIPT+CSS implementation of the collapsible level two menu. Share to everyone for your reference, specific as follows:

. aspx file:

<%@ 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:

function Domenu (obj) {
 var items=obj.parentnode.getelementsbytagname ("ul");
 var Itmul;
 if (items.length>0) {
 itmul=items[0];
 }
 if (itmul.classname!= "ex") {
 cxall ();
 Itmul.classname= "ex";
 } else{
 itmul.classname= "CX";
 }
}
function Statup () {
 cxall ();
}
function Cxall () {
 var Uldom=document.getelementbyid ("Nav");
 var items=uldom.getelementsbytagname ("ul");
 for (Var i=0;i<items.length;i++)
 {
 items[i].classname= "CX";
 }
}

Note Here is the problem of delayed loading, because the page loading needs to perform preprocessing operations Statup () method, JS written in a separate file or JS write in

Another way to do this is to write all of the JavaScript directly in

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">  

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 JavaScript programming.

Related Article

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.