相关数据库结构请查看 http://blog.youkuaiyun.com/piperzero/archive/2006/07/25/977083.aspx 二级树 如下 同时展开一个 <!-- 以下是可以同时只能打开一个子目录的二级数 --> <!-- #includefile="inc/conn.asp" --> <% ... setrs=conn.execute("select*frombigclass")ifrs.recordcount=0thenResponse.Write("暂无")elsei=0whilenotrs.eofResponse.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=0thenResponse.Write("<divid=""menu"&i&"""style=""DISPLAY:none"">├暂无</div>"&CHR(10))elseResponse.Write("<divid=""menu"&i&"""style=""DISPLAY:none"">"&CHR(10))whilenotrs2.eofResponse.Write("├<ahref=""product.asp?bigclassname="&rs("bigclassname")&"&smallclassname="&rs2("smallclassname")&""">"&rs2("smallclassname")&"</a><br>"&CHR(10))rs2.movenextwendResponse.Write("</div>"&CHR(10))endifrs2.closesetrs2=nothingi=i+1rs.movenextwendendifrs.closesetrs=nothingResponse.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>") %>