以下是最的一个动态树行菜单,子菜单可以打开多个.子菜单没有项目时候父菜单仍然可以使用.在有
子菜单时候父菜单仍然可以打开
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center" >
<%
set rsBigClass1=server.CreateObject("adodb.recordset")
rsBigClass1.open "Select * From bigclass",conn,1,1
i=0
do while not rsBigClass1.eof
i=i+1
%>
<tr valign="top">
<td width="90%"> <a href="Product.asp?bigclassname=<%=rsBigClass1("bigclassname")%>" class="my1"><%=rsBigClass1("bigclassname")%></a>
<script>
function showtable<%="a"&i%>()
{
if(document.all("<%="a"&i%>").style.display=="none")
{document.all("<%="a"&i%>").style.display="";}
else
{document.all("<%="a"&i%>").style.display="none";}
}
</script>
</Td><Td valign="middle"><a href="#" onClick="javascript:showtable<%="a"&i%>();"><%set rscheck=server.CreateObject("adodb.recordset")
rscheck.open "Select * From smallclass Where bigclassname='" & rsBigClass1("bigclassname") & "'",conn,1,1
if not(rscheck.bof and rscheck.eof) then%><img src=images/nvdown.jpg border="0"><%end if%></a></td>
</tr>
<%
set rsSmallClass1=server.CreateObject("adodb.recordset")
rsSmallClass1.open "Select * From smallclass Where bigclassname='" & rsBigClass1("bigclassname") & "'",conn,1,1
if not(rsSmallClass1.bof and rsSmallClass1.eof) then
%>
<tr valign="top">
<td><table border=0 cellspacing=0 cellpadding=0 id="<%="a"&i%>" style="display:none"><tr><td><%do while not rsSmallClass1.eof%><tr valign="top">
<td> <a href="Product.asp?bigclassname=<%=rsBigClass1("bigclassname")%>&smallclassname=<%=rsSmallClass1("smallclassname")%>" class="my1"><%=rsSmallClass1("smallclassname")%></a><%rsSmallClass1.movenext
loop%></td></tr></table></td>
</tr>
<%
end if
rsSmallClass1.close
set rsSmallClass1=nothing
rsBigClass1.movenext
loop
rsbigclass1.close
set rsbigclass1=nothing
%>
</table>
<%
set rsBigClass1=server.CreateObject("adodb.recordset")
rsBigClass1.open "Select * From bigclass",conn,1,1
i=0
do while not rsBigClass1.eof
i=i+1
%>
<tr valign="top">
<td width="90%"> <a href="Product.asp?bigclassname=<%=rsBigClass1("bigclassname")%>" class="my1"><%=rsBigClass1("bigclassname")%></a>
<script>
function showtable<%="a"&i%>()
{
if(document.all("<%="a"&i%>").style.display=="none")
{document.all("<%="a"&i%>").style.display="";}
else
{document.all("<%="a"&i%>").style.display="none";}
}
</script>
</Td><Td valign="middle"><a href="#" onClick="javascript:showtable<%="a"&i%>();"><%set rscheck=server.CreateObject("adodb.recordset")
rscheck.open "Select * From smallclass Where bigclassname='" & rsBigClass1("bigclassname") & "'",conn,1,1
if not(rscheck.bof and rscheck.eof) then%><img src=images/nvdown.jpg border="0"><%end if%></a></td>
</tr>
<%
set rsSmallClass1=server.CreateObject("adodb.recordset")
rsSmallClass1.open "Select * From smallclass Where bigclassname='" & rsBigClass1("bigclassname") & "'",conn,1,1
if not(rsSmallClass1.bof and rsSmallClass1.eof) then
%>
<tr valign="top">
<td><table border=0 cellspacing=0 cellpadding=0 id="<%="a"&i%>" style="display:none"><tr><td><%do while not rsSmallClass1.eof%><tr valign="top">
<td> <a href="Product.asp?bigclassname=<%=rsBigClass1("bigclassname")%>&smallclassname=<%=rsSmallClass1("smallclassname")%>" class="my1"><%=rsSmallClass1("smallclassname")%></a><%rsSmallClass1.movenext
loop%></td></tr></table></td>
</tr>
<%
end if
rsSmallClass1.close
set rsSmallClass1=nothing
rsBigClass1.movenext
loop
rsbigclass1.close
set rsbigclass1=nothing
%>
</table>