刚才帮小高做了个动态调取数据的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">
☉ <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
%>