Home >Web Front-end >JS Tutorial >Click button to display hidden submenu classic case_javascript skills

Click button to display hidden submenu classic case_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:44:341160browse
Copy code The code is as follows:

var count=0;//Make a counter
var limit=new Array();//Used to record which menus are currently displayed
var countlimit=1;//Open menus at the same time Number, can be customized
function expandIt(el) {
obj = eval("" el);
if (obj.style.display == "none") {
obj.style. display = "block";//Display submenu
if (countlimit[count]=el;//Enter array
count;
}
else {
eval("" limit[0]).style.display = "none";
for (i=0;ilimit[limit.length-1]=el;
}
}
else {
obj.style.display = "none";
var j;
for (i=0;ifor (i=j;ilimit[limit.length-1]=null;//Delete the last digit of the array
count--;
}
}
// - ->

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn