asp树形菜单

假设菜单页为left.asp,产品页为product.asp

left.asp源码如下:

< table width = " 100% "   border = " 0 "  cellspacing = " 0 "  cellpadding = " 0 " >
< %
sql
= " select * from class1 order by Class1Id asc "   ' 读出大类
set  sortRootRs = conn.execute (sql)
i
= 0
do   while   not  (sortRootRs.eof  or  err)
    sortRootRsID
= sortRootRs( " class1id " )
    %
>
    
< tr >
            
< td height = " 18 "  align = " left "  valign = " top "  background = " images/pole_1.jpg " >< div style = " padding-left:12px; padding-top:0px " >
            
< a href = " products.asp?class1id=<%=sortRootRs( " class1id " )%> " >< span class = " style6 " >       < % = sortRootRs( " class1name " )% ></ span ></ a > ' 显示大类列表
             </ div ></ td >
    
</ tr >
    
< tr id = child < % = sortRootRsID% >  style = ' display:none'>'小类列表用样式控制它默认不显示
     < td height = " 18 "  align = " left "  valign = " top "  background = " images/pole_2.jpg " >
    
< %
    sql
= " select * from class2 where class1ID= " & sortRootRs( " class1id " ) & "  order by Class2Id asc "   ' 读出小类
     set  sortChildRs = server.createObject( " adodb.recordset " )
    sortChildRs.open sql,conn,
1 , 1
    j
= 1
    
' k=sortchildRs.recordcount
     do   while   not  (sortChildRs.eof  or  err)
    %
>
      
< div style = " padding-left:12px; padding-top:0px;line-height:18px; " >
        
< a href = " products.asp?class1id=<%=sortRootRs( " class1id " )%>&class2id=<%=sortChildRs( " class2id " )%> "  class = " style7 "  style = " text-decoration:none  " >< % = sortChildRs( " class2name " )% ></ a >  
      
</ div >
        
< %j = j + 1
        
' if j>100 then exit do
        sortChildRs.moveNext
    
loop % > ' 小类循环
     </ td >
    
</ tr >
< %
    i
= i + 1
    
if  i > 100   then   exit   do
    sortRootRs.moveNext
loop  
%
>   ' 大类循环
         </ table >

product.asp

< script language = Javascript >
< ! --
function  window_onload(i){
childSort
= document.all( " child "   +  i);
// theTd = document.all( " td "   +  i);
    
if (childSort.style.display == " none " ){
//         theTd.bgcolor = " #ffffff " ;
        childSort.style.display
= "" ;}
    
else {
//         theTd.bgcolor = " #000000 " ;
        childSort.style.display
= " none " ;}
}

//-->
</ script >

< html >
< body  onload = " window_onload(<%=class1id%>) " >
< ! -- #include file = " left.asp "   -->
</ body >
</ html >

 

如果您觉得以上内容对您有所帮助,请支持以下链接Http://www.lvyedianzi.com

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值