js动态的级联二级菜单

刚才帮小高做了个动态调取数据的JS菜单效果,弄了一下,记录下来以备后来用到。

<script>
function showsubmenu(sid)
{
whichEl = eval("submenu" + sid);
imgmenu = eval("imgmenu" + sid);
if (whichEl.style.display == "none")
{
eval("submenu" + sid + ".style.display=/"/";");
imgmenu.background="nimages/admin_2.GIF";
}
else
{
eval("submenu" + sid + ".style.display=/"none/";");
imgmenu.background="nimages/admin_1.GIF";
}
}

function loadingmenu(id){
var loadmenu =eval("menu" + id);
if (loadmenu.innerText=="Loading..."){
document.frames["hiddenframe"].location.replace("LeftTree.asp?menu=menu&id="+id+"");
}
}
</script>

 

 

<%
    set rs=server.CreateObject("adodb.recordset")
    rs.open "select * from xr_anclass order by anclassidorder",conn,1,1
    if rs.recordcount=0 then
    response.write "<br>目前没有商品分类"
    else
    i=1
    do while not rs.eof
  %>     
 
<table border="0" width="158" cellspacing="0" cellpadding="0">
    <tr id="imgmenu<%=i%>" onClick="showsubmenu(<%=i%>)"  style="cursor:hand" class="menul">
        <td width="20" height="28" align="center"><img name="index_pic_r16_c6" src="images/index_pic_r16_c6.jpg" width="13" height="13" border="0" id="index_pic_r16_c6" alt="" /></td>
        <td width="160"><%=rs("anclass")%></td>
            </tr>
     <tr>
        <td height="1" colspan="2" background="images/left_bg2.gif"></td>
        </tr>      
    <tr>
        <td id="submenu<%=i%>" colspan="2" style="display:none" >
        <table border="0" width="100%" cellspacing="0" cellpadding="0" height="18">
            <tr>
                <td class="table00<%=i%>" height="23">
               
               
                <table border="0" width="100%" cellspacing="0" cellpadding="0" height="23">
                  <%
           set r1=server.CreateObject("adodb.recordset")
           r1.open "select * from xr_nclass where anclassid="&rs("anclassid"),conn,1,1
           if r1.recordcount=0 then
           %>
            <tr>
             <td></td>
            </tr>
           <%
           else
           do while not r1.eof
            %>
                  <tr>
                        <td height="23">&nbsp;
                        ☉ <a href='shoplist.asp?lx=small&anid=<%=rs("anclassid")%>&nid=<%=r1("nclassid")%>'><%=r1("nclass")%></a></td>
                  </tr>
                <%
          r1.movenext
          if r1.eof then exit do
          loop
          end if
          r1.close
          set r1=nothing
         %>
                </table>
              </td>
            </tr>
        </table>
        </td>
    </tr>
</table>


  <%
    rs.movenext
    i=i+1
    if rs.eof then exit do
    loop
    end if
    rs.close
    set rs=nothing
  %>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值