asp无限分级(递归调用)

2018-09-06 13:20

阅读:616

  数据库字段:id(自动编号),class_name(菜单名),parentID(父菜单id)
复制代码 代码如下:
<%
dimm
m=0
callShowTree(0)%>
<%
SubShowTree(parentID)
dims
m=m+1
Dimrs
Setrs=Server.CreateObject(ADODB.RecordSet)
sql=Selectclass_id,class_nameFROM[WMS_Class]whereclass_father_id=&Cint(parentID)
rs.opensql,Conn,1,1
ifrs.eofandm=1then
response.Write(该频道暂无栏目)
endif
DoWhileNotrs.Eof
response.Writers(0)
forn=1tom
ifn=mandm=1then
Response.Write(╋)
elseifn=1then
Response.Write()
elseifn=mthen
Response.Write(├)
else
Response.Write(│)
endif
next
response.Writers(1)&<br>
CallShowTree(rs(0))
m=m-1
rs.Movenext
Loop
EndSub
%>


评论


亲,登录后才可以留言!