js动态的级联二级菜单
2010-03-18 21:45
507 查看
刚才帮小高做了个动态调取数据的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
%>
<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
%>
相关文章推荐
- js简单的二级级联菜单
- Ajax实现动态的二级级联菜单
- js生成二级城市联动菜单,动态生成年、月、日字段,生产一个验证码
- js+xmlHttpRequest实现无刷新二级级联菜单(ajax原始)
- smarty + ajax 实现二级动态级联菜单
- 34.6.1 Excel数据有效性的高级应用【动态二级级联菜单/如百度输入框Ajax效果的下拉菜单/圈出无效数据】
- CSS控制二级菜单动态出现不只有js才能做到
- 城市地区级联二级下拉选择菜单js特效
- html+js+PHP(使用了smarty模板技术)+mysql实现二级动态下拉列表(select)
- asp二级动态级联列表
- struts2中级联菜单标签<s:doubleselect>的若干常见问题(二级菜单不显示,FreeMarker问题)
- js 全兼容可高亮二级缓冲折叠菜单
- 二级动态导航菜单特效
- 动态侧拉菜单,二级.方便改为下拉菜单
- 动态二级菜单
- js 动态生成下拉列表 下拉列表级联
- js入门·表单元素(select下拉列表)制作二级联动菜单和网站导航
- js实现的黑背景灰色二级导航菜单效果代码
- 垂直手风琴5级菜单!用js+jquery动态加载菜单,附上源码hezhu和注释