asp动态树菜单集合(2/3)

相关数据库结构请查看

 http://blog.csdn.net/piperzero/archive/2006/07/25/977083.aspx

二级树

如下

asp动态树菜单集合(2/3)

同时展开一个

<!-- 以下是可以同时只能打开一个子目录的二级数 -->
<!-- #include file="inc/conn.asp" -->
<%
set rs=conn.execute("select * from bigclass")
if rs.recordcount=0 then
Response.Write(
"暂无")
else
i
=0
while not rs.eof
Response.Write(
"┬ <a href=""javascript:menu"&i&"func()""><b>"&rs("bigclassname")&"</b></a><br>"&CHR(10))
ljh_temp
=ljh_temp&"menu"&i&".style.display=""none"";"&CHR(10)
ljh_temp2
=ljh_temp2&"function menu"&i&"func()"&CHR(10)&"{"&CHR(10)&"if(menu"&i&".style.display==""none"")"&CHR(10)&"{"&CHR(10)&"startmenu();"&CHR(10)&"menu"&i&".style.display=""block"";"&CHR(10)&"}"&CHR(10)&"else"&CHR(10)&"{"&CHR(10)&"startmenu();"&CHR(10)&"}"&CHR(10)&"}"&CHR(10)&""
set rs2=conn.execute("select * from smallclass where bigclassname='"&rs("bigclassname")&"'")'因为是字符型,所以用到了''
if rs2.recordcount=0 then
Response.Write(
"<div id=""menu"&i&""" style=""DISPLAY: none"">├ 暂无</div>"&CHR(10))
else
Response.Write(
"<div id=""menu"&i&""" style=""DISPLAY: none"">"&CHR(10))
while not rs2.eof
Response.Write(
"├ <a href=""product.asp?bigclassname="&rs("bigclassname")&"&smallclassname="&rs2("smallclassname")&""">"&rs2("smallclassname")&"</a><br>"&CHR(10))
rs2.movenext
wend
Response.Write(
"</div>"&CHR(10))
end if
rs2.close
set rs2=nothing
i
=i+1
rs.movenext
wend
end if
rs.close
set rs=nothing
Response.Write(
"<script language=""javascript"" type=""text/javascript"">"&CHR(10))
Response.Write(
"function startmenu()"&CHR(10)&"{"&CHR(10)&ljh_temp&"}"&CHR(10))
Response.Write(ljh_temp2)
Response.Write(
"</script>")
%>

你可能感兴趣的:(asp)