二级树菜单,可以同时打开多个子菜单

如下类型

数据库结构如下:

为了方便全部程序的调试,有多余字段,使用时请删除多余字段.

bigclass表

bigclassid bigclassname

smallclass表

smallclassname,smallclassid,bigclassid,bigclassname

<!--#include file="inc/conn.asp"-->
<table border="0" width="100%" height="200" cellspacing="0" cellpadding="0">
  
<tr>
    
<td width="20%" height="200" bgcolor="#F0F0F0" valign=top>
    
<script language="JavaScript">
<!--
function showLay(divId){
    var objDiv 
= eval(divId);
    
if (objDiv.style.display=="none"){
        eval(
"sp"+divId+".innerHTML='-'");
        objDiv.style.display
="";
    }
else{
        eval(
"sp"+divId+".innerHTML='+'");
        objDiv.style.display
="none";
    }
}
// -->
</script>
<%
dim rsTEMP,sqlTEMP
bigclassname    
= request("bigclassname")
smallclassname 
= request("smallclassname")

call openDB()
sql
="select bigclassid,bigclassname from bigclass"
set rs=conn.execute(sql)
counter
=0    '---------------------------------------------------------------------A COUNTER USED
while not rs.eof
    counter
=counter+1
    sqlTEMP
="select smallclassname from smallclass where bigclassid="&rs("bigclassid")
    
set rsTEMP=conn.execute(sqlTEMP)
    
if bigclassname<>rs("bigclassname"then
        %
>
        
<a href="#" onclick="showLay('Layer<%=counter%>')"><span id="spLayer<%=counter%>">+</span><%=rs("bigclassname")%></a><br>
        
<div id="Layer<%=counter%>" style="display:none;">
        
<%while not rsTEMP.eof%>
            |
-<a  HREF="bookincategory.asp?bigclassname=<%=rs("bigclassname")%>&smallclassname=<%=rsTEMP("smallclassname")%>">
            
<%=rsTEMP("smallclassname")%></a><br>  
            
<%
            rsTEMP.movenext
        wend
    
else
        %
>
        
<a href="#" onclick="showLay('Layer<%=counter%>')"><span id="spLayer<%=counter%>">-</span><%=rs("bigclassname")%></a><br>
        
<div id="Layer<%=counter%>">
        
<%while not rsTEMP.eof%>
            |
-<a  HREF="bookincategory.asp?bigclassname=<%=rs("bigclassname")%>&smallclassname=<%=rsTEMP("smallclassname")%>">
            
<%=rsTEMP("smallclassname")%></a><br>  
            
<%
            rsTEMP.movenext
        wend
    
end if
    %
>
    
</div>
<%
rs.movenext
wend
%
>
    
</td>
    
<td width="80%" height="200" bgcolor="#F7FDFD">

    
</td></tr></table>