Copy codeThe Code is as follows:
<Mce: script language = "javascript"> <! --
Var count = 0; // counter
Var limit = new Array (); // used to record which menus are currently displayed
Var countlimit = 1; // you can specify the number of menus that can be opened at the same time.
Function expandIt (el ){
Obj = eval ("" + el );
If (obj. style. display = "none "){
Obj. style. display = "block"; // displays the sub-menu.
If (count <countlimit) {// limit 2
Limit [count] = el; // input an array
Count ++;
}
Else {
Eval ("" + limit [0]). style. display = "none ";
For (I = 0; I <limit. length-1; I ++) {limit [I] = limit [I + 1];} // The array turns around one and moves one forward.
Limit [limit. length-1] = el;
}
}
Else {
Obj. style. display = "none ";
Var j;
For (I = 0; I <limit. length; I ++) {if (limit [I] = el) j = I ;}// obtain the position of the currently clicked menu in the limit Array
For (I = j; I <limit. length-1; I ++) {limit [I] = limit [I + 1];} // All arrays after j are moved forward by one
Limit [limit. length-1] = null; // Delete the last digit of the array
Count --;
}
}
// --> </Mce: script>