Implementation of the level three Drop-down menu:
Copy Code code as follows:
Function List (IDSTR) {
var name1= "subtree" +IDSTR;
var name2= "img" +IDSTR;
var objectobj=document.all (name1);
var imgobj=document.all (name2);
alert (imgobj);
if (objectobj.style.display== "None") {
for (i=1;i<22;i++) {
var name3= "img" +I;
var name= "subtree" +i;
var o=document.all (name);
if (o!=undefined) {
O.style.display= "None";
var image=document.all (Name3);
alert (image);
Image.src= "<%=basepath%>admin/images/ico04.gif";
if (idstr>12&&idstr<20) {
document.getElementById ("Subtree11"). style.display= "";
document.getElementById ("Img11"). src= "<%=basepath%>admin/images/ico03.gif";
}
}
}
Objectobj.style.display= "";
Imgobj.src= "<%=basepath%>admin/images/ico03.gif";
}
else{
Objectobj.style.display= "None";
Imgobj.src= "<%=basepath%>admin/images/ico04.gif";
}
}
Code explanation: such as
, Idstr is a numeric character used to differentiate between different submenus and pictures. Through document.all (name1) to get all the ID name1 (a variable) submenu, here
In fact, there is only one, to judge if the current is hidden state, then enter the loop, and if the element is defined (for convenience, some of the submenus fetched through I may be undefined) hide all submenus (except Level 1 menu, including 2, Level 3 menu), change the current sibling menu icon, and finally display the currently selected menu , and replace the currently selected icon. There is a special situation: when idstr>12&&idstr<20, then it is the second level menu to activate the third Level menu expansion, the following figure: selected paper management, because results-based management is the parent of the paper Management menu, results Management can not hide, so there is if ( IDSTR>12&&IDSTR<20) followed by the code block. The last else is well understood, if the currently selected menu is expanded and hidden, and the icon is replaced.
Copy Code code as follows:
function Tupian (IDT) {
var nametu= "Xiaotu" +IDT;
var tp = document.getElementById (Nametu);
Tp.src= "<%=basepath%>admin/images/ico05.gif";//Picture ico05 a white square
for (Var i=1;i<32;i++)
{
var nametu2= "Xiaotu" +i;
if (i!=idt*1)
{
var Tp2=document.getelementbyid (' Xiaotu ' +i);
if (tp2!=undefined)
{tp2.src= "<%=basepath%>admin/images/ico06.gif";} Picture ico06 as a blue square
}
}
}
Code Description: Just replace the icon, indicating activation or deactivation.