树形菜单
<SCRIPT language=javascript>
function opencat(cat,img){
if(cat.style.display== "none "){
cat.style.display= " ";
img.src= "img/class2.gif ";
} else {
cat.style.display= "none ";
img.src= "img/class1.gif ";
}
}
</Script>
我想写个树形菜单,如:
+吕吕
+吕吕
+吕吕
+吕吕
+吕吕
就这样的该怎么搞啊
------解决方案-------------------- <HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME= "Generator " CONTENT= "EditPlus ">
<META NAME= "Author " CONTENT= " ">
<META NAME= "Keywords " CONTENT= " ">
<META NAME= "Description " CONTENT= " ">
<script language= "JavaScript1.2 ">
<!--
var head= "display: ' ' "
img1=new Image()
img1.src= "fold.gif "
img2=new Image()
img2.src= "open.gif "
function change()
{
if(!document.all)
return
if (event.srcElement.id== "foldheader ")
{
var srcIndex = event.srcElement.sourceIndex
var nested = document.all[srcIndex+1]
if (nested.style.display== "none ")
{
nested.style.display= ' '
event.srcElement.style.listStyleImage= "url(open.gif) "
}
else
{
nested.style.display= "none "
event.srcElement.style.listStyleImage= "url(fold.gif) "
}
}
}
document.onclick=change
//-->
</script>
</HEAD>
<BODY>
<ul>
<li id= "foldheader "> 主1 </li>
<ul id= "foldinglist " style= "display:none ">
<li> <font color= "#666666 "> 主1-子1 </font> </li>
<li id= "foldheader "> <font color= "#666666 "> 主1-子2 </font> </li>
<ul id= "foldinglist " style= "display:none ">
<li> <font color= "#666666 "> 主1-子1 </font> </li>
<li> <font color= "#666666 "> 主1-子2 </font> </li>
</ul>
</ul>
<li id= "foldheader "> 主2 </li>
<ul id= "foldinglist " style= "display:none ">
<li> <font color= "#666666 "> 主2-子1 </font> </li>
<li id= "foldheader "> <font color= "#666666 "> 主2-子2 </font> </li>
<li id= "foldheader "> 主2-子3 </li>
<ul id= "foldinglist " style= "display:none ">
<li> <font color= "#666666 "> 主2-子3-子1 </font> </li>
<li id= "fol