网站开发与移动开发

博客园 首页 新随笔 管理

三级树形菜单,之前有发过一个那个和这个还是有区别的.表结构仍然是我一直发的那样的.注意,不能打开二级类

就是说只能打开大类和三级类.当有类别无三级类时候,就不适用了.

 

<!--#include file="inc/conn.asp"-->




      
<TABLE width=190 >
       
              
<TR>
                
<TD width="100%">
                  
                
                
                 
<%
        
set rsBigClass1=server.CreateObject("adodb.recordset")
rsBigClass1.open 
"Select * From BigClass",conn,1,1
    i
=100

    
do while not rsBigClass1.eof
    i
=i+100
%
>
                
                  
<TABLE id=LeftMenu_<%=i%>_off cellSpacing=0 cellPadding=0  
                  width
="100%">
                    
<TBODY>
                    
<TR class=tree_button_title 
                    onmouseover
="this.className='tree_button_title_on';" 
                    onclick
="document.getElementById('LeftMenu_<%=i%>_on').style.display=(document.getElementById('LeftMenu_<%=i%>_on').style.display == 'none')?'':'none';document.getElementById('LeftMenu_<%=i%>_off').style.display=(document.getElementById('LeftMenu_<%=i%>_off').style.display=='none')?'':'none'" 
                    onmouseout
="this.className='tree_button_title'">
                      
<TD><B><
                        href
="Product.asp?bigclassname=<%=rsBigClass1("BigClassName")%>" 
                        
><%=rsbigclass1("bigclassname")%></A></B>&nbsp;&nbsp;</TD>
                      
<TD align=right><IMG 
                        src
="newegg_menu/plus.gif"></TD></TR></TBODY></TABLE>
                        
                
                        
                  
<TABLE id=LeftMenu_<%=i%>_on style="DISPLAY: none" cellSpacing=0 
                  cellPadding
=0 width="100%">                    <TBODY>
                    
                    
<TR>
                      
<TD>
                      
                      
                      
                        
<TABLE cellSpacing=0 cellPadding=0 width="100%">
                          
<TBODY>
                          
<TR class=tree_button_title 
                          onmouseover
="this.className='tree_button_title_on';" 
                          onclick
="document.getElementById('LeftMenu_<%=i%>_on').style.display=(document.getElementById('LeftMenu_<%=i%>_on').style.display == 'none')?'':'none';document.getElementById('LeftMenu_<%=i%>_off').style.display=(document.getElementById('LeftMenu_<%=i%>_off').style.display=='none')?'':'none'" 
                          onmouseout
="this.className='tree_button_title'">
                            
<TD><B><
                              href
="Product.asp?bigclassname=<%=rsBigClass1("BigClassName")%>" 
                              
><%=rsbigclass1("bigclassname")%></A></B>&nbsp;&nbsp;</TD>
                            
<TD align=right><IMG 
                              src
="newegg_menu/minus.gif"></TD></TR></TBODY></TABLE>
                    
<%
      
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
       j
=33
        
do while not rsSmallClass1.eof
        j
=j+100

    %
>        
                     
<!--三级类关闭时候-->
                       
<TABLE id=LeftMenu_<%=i%>_<%=j%>_off cellSpacing=0 
                        cellPadding
=0 width="100%" border=0>
                          
<TBODY>
                          
<TR>
                            
<TD class=tree_button 
                            onmouseover
="this.className='tree_button_on';" 
                            onclick
="document.getElementById('LeftMenu_<%=i%>_<%=j%>_on').style.display=(document.getElementById('LeftMenu_<%=i%>_<%=j%>_on').style.display == 'none')?'':'none';document.getElementById('LeftMenu_<%=i%>_<%=j%>_off').style.display=(document.getElementById('LeftMenu_<%=i%>_<%=j%>_off').style.display=='none')?'':'none'" 
                            onmouseout
="this.className='tree_button'"><IMG 
                              height
=6 
                              src
="newegg_menu/arrow_right.gif" 
                              width
=5 border=0>&nbsp;<FONT 
                              size
=+0><%=rsSmallClass1("SmallClassName")%></FONT>&nbsp;&nbsp;</TD></TR></TBODY></TABLE>
            
                              
                    
<!--三级类关闭时候-->
                    
                    
                    
                    
                        
                        
<!--三级类展开时候-->     
                        
<TABLE id=LeftMenu_<%=i%>_<%=j%>_on style="DISPLAY: none" 
                        cellSpacing
=0 cellPadding=0 width="100%" border=0>
                            
<TBODY>
                            
<TR>
                            
<TD>
                              
<TABLE cellSpacing=0 cellPadding=0 width="100%" 
                              border
=0>
                                
<TBODY>
                                
<TR>

                                
<TD class=tree_button 
                                onmouseover
="this.className='tree_button_on';" 
                                onclick
="document.getElementById('LeftMenu_<%=i%>_<%=j%>_on').style.display=(document.getElementById('LeftMenu_<%=i%>_<%=j%>_on').style.display == 'none')?'':'none';document.getElementById('LeftMenu_<%=i%>_<%=j%>_off').style.display=(document.getElementById('LeftMenu_<%=i%>_<%=j%>_off').style.display=='none')?'':'none'" 
                                onmouseout
="this.className='tree_button'"><IMG 
                                height
=6 
                                src
="newegg_menu/arrow_down.gif" 
                                width
=5 border=0>&nbsp;<FONT 
                                size
=+0><%=rsSmallClass1("SmallClassName")%></FONT>&nbsp;&nbsp;</TD></TR></TBODY></TABLE>
                                          
<!--三级类-->
                                          
<TABLE cellSpacing=0 cellPadding=0 width="100%" 
                                              border
=0>
                                            
<TBODY>
                                               
<TR>
                                            
<TD class=tree_button_content>
                                            
<%sql3="select * from minclass where BigClassName='" & rsBigClass1("BigClassName"& "' and smallclassname='" & rsSmallClass1("SmallClassName"& "'"
       
set rs3=Server.CreateObject("adodb.recordset")
       rs3.Open sql3,conn,
1,1 
    
do while not rs3.eof%>
                                
                                
<DIV class=tree_button_list><
                                href
="Product.asp?bigclassname=<%=rsBigClass1("BigClassName")%>&smallclassname=<%=rsSmallClass1("SmallClassName")%>&minclassname=<%=rs3("minclassname")%>"><%=rs3("minclassname")%></A></DIV>
                               
<%
                               rs3.movenext
                               
loop
                               %
>
                                
                                            
</TD>
                                            
</TR>
                                            
</TBODY>
                                        
</TABLE>
                                        
<!--三级类-->                            
                                
</TD></TR></TBODY>
                            
</TABLE>
                            
<!--三级类展开时候-->    
                            
<%rsSmallClass1.movenext
        
loop
      
end if
      rsSmallClass1.close
      
set rsSmallClass1=nothing    %>
                            
</TD>
                            
</TR>
                            
</TBODY>
                        
</TABLE>
                        
                                
                                
                        
                                
<%
    rsBigClass1.movenext
    
    
loop
    rsbigclass1.close
    
set rsbigclass1=nothing
%
>            
                                
</TD></TR>
                                
                            
</TABLE>
                            
http://www.corange.cn/archives/2007/03/24.html
posted on 2007-03-29 22:06  txf2004  阅读(191)  评论(0编辑  收藏  举报