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.