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

相关数据库结构请查看

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

二级树

如下

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

同时展开一个

<!-- 以下是可以同时只能打开一个子目录的二级数 -->
<!-- #includefile="inc/conn.asp" -->
<% ...
setrs=conn.execute("select*frombigclass")
ifrs.recordcount=0then
Response.Write(
"暂无")
else
i
=0
whilenotrs.eof
Response.Write(
"┬<ahref=""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&"functionmenu"&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)&""
setrs2=conn.execute("select*fromsmallclasswherebigclassname='"&rs("bigclassname")&"'")'因为是字符型,所以用到了''
ifrs2.recordcount=0then
Response.Write(
"<divid=""menu"&i&"""style=""DISPLAY:none"">├暂无</div>"&CHR(10))
else
Response.Write(
"<divid=""menu"&i&"""style=""DISPLAY:none"">"&CHR(10))
whilenotrs2.eof
Response.Write(
"├<ahref=""product.asp?bigclassname="&rs("bigclassname")&"&smallclassname="&rs2("smallclassname")&""">"&rs2("smallclassname")&"</a><br>"&CHR(10))
rs2.movenext
wend
Response.Write(
"</div>"&CHR(10))
endif
rs2.close
setrs2=nothing
i
=i+1
rs.movenext
wend
endif
rs.close
setrs=nothing
Response.Write(
"<scriptlanguage=""javascript""type=""text/javascript"">"&CHR(10))
Response.Write(
"functionstartmenu()"&CHR(10)&"{"&CHR(10)&ljh_temp&"}"&CHR(10))
Response.Write(ljh_temp2)
Response.Write(
"</script>")
%>

你可能感兴趣的:(JavaScript,数据结构,.net,asp.net,asp)