Current location - Training Enrollment Network - Mathematics courses - Directory tree problem
Directory tree problem
I turned the first column directory into a three-level structure, and the code is as follows:

& lthtml & gt

& lthead & gt

& ltmeta http-equiv = " Content-Type " Content = " text/html; charset=gb23 12 " >

& lttitle & gt untitled document

& lt scripting language = "JavaScript" type = "text/JavaScript" >

& lt! -

Function menu (str, picid) (

var obj,pic

//Returns whether the str object and the picId object exist.

if(document . getelementbyid(str)& amp; & ampdocument . getelementbyid(picId)){

obj = document . getelementbyid(str); //obj is a DIV object.

pic = document . getelementbyid(picId); //pic is a picture object.

If (obj.style.display = = "none") {//If the display style value of the DIV object is none.

obj . style . display = " "; //Clear the display style.

pic . src = " 000 1 . jpg "; //Change the path of the picture object

} Otherwise {

obj . style . display = " none ";

pic . src = " 0000 . jpg ";

}

}

}

//-& gt;

& lt/script & gt;

& ltstyle type="text/css " >

& lt! -

. div 1 {

Cursor: hand;

Width:100px;

}

. div 1_ 1{

Cursor: hand;

Width:100px;

Color: # 666666;

Font size: 14px

}

. div2 {

Color: # 666666;

font-size: 12px;

}

-& gt;

& lt/style & gt;

& lt/head & gt;

& ltbody & gt

& lt! -The tree in the first column->;

& ltdiv onClick="menus('menu 1 ',' pic 1')" class="div 1 " >。 & ltimg src = "0000.jpg" align = "absmiddle" id = "pic1"> Chinese.

& ltdiv onClick = " menus(' menu 1 _ 1 ',' pic 1 ')" class = " div 1 _ 1 " & gt; & ltimg src = "0000.jpg" align = "absmiddle" id = "pic1"> classical Chinese;

& ltdiv id = " menu 1 _ 1 " style = " display:none " class = " div 2 " >

Classical Chinese 1

& lt/div & gt;

& lt div onclick = "menus ('menu1_ 2',' pic1')" class = "div1_1"> & ltimg src = "0000.jpg" align = "absmid.

& ltdiv id = " menu 1 _ 2 " style = " display:none " class = " div 2 " >

Synthesis 1

& lt/div & gt;

& lt div onclick = "menus ('menu1_ 3',' pic1')" class = "div1_1"> & ltimg src = "0000.jpg" align = "absmid.

& ltdiv id = " menu 1 _ 3 " style = " display:none " class = " div 2 " >

Syntax 1

& lt/div & gt;

& lt/div & gt;

& lt! -The tree in the second column->;

& ltdiv onClick="menus('menu2',' pic2') "class =" div1"> & ltimgsrc =" 0000.jpg "align =" absmiddle "id =" pic2 "> Mathematics.

& ltdiv id = " menu 2 " style = " display:none " class = " div 2 " >

Algebra < br/>;

Geometry < br/ >

& lt/div & gt;

& lt! -The tree in the third column->;

& ltdiv onClick="menus('menu3',' pic3') "class =" div1"> & ltimgsrc =" 0000.jpg "align =" absmiddle "id =" pic3 "> minor course.

& ltdiv id = " menu 3 " style = " display:none " class = " div 2 " >

Geography < br/ >

Biology < br/>;

history

& lt/div & gt;

& ltdiv onClick="menus('menu4',' pic4') "class =" div1"> & ltimg src =" 0000.jpg "align =" absmiddle "id =" pic4 "> minor course.

& ltdiv id = " menu 4 " style = " display:none " class = " div 2 " >

Geography < br/ >

Biology < br/>;

history

& lt/div & gt;

& lt/body & gt;

& lt/html & gt;