Simple use of list in JavaScript (menu)

Source: Internet
Author: User

Simple use of list in JavaScript (menu)

Easy to use: Click the menu to display the following or not

1. Main Purpose: display a menu item, click it, hide it, and click it. The following content is displayed.
The overflow: hidden and overflow = visible attributes are used in the clicked function.
Node. style. overflow = visible; of course, setting the height of tr is also very important, so that other options should be hidden.
2. Use the same technique and add a few more parameters, but passing parameters is troublesome. Using this parameter is very common.

 

    <Script type = text/javascript> function click2 (node1) {// alert (aa + node. nodeName); // tdvar nodes = node1.parentNode; // alert (nodes. nodeName); // alert (aa + nodes. className); // ※※※this determines the css mode if (nodes. className = open) {nodes. className = close;} else {nodes. className = open ;}</script>   


1 menu bar 1
Menu 1
Menu 2
Menu 3
Menu 4
2 menu bar 2
Menu 11
Menu 22
Menu 33
Menu 44
3 menu bar 3
Menu 12
Menu 23
Menu 34
Menu 45
Before clicking:

 

After clicking: The color setting is set in css.

 

 

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.