RSS
热门关键字:  ASP.NET  ASP  ASP.NET文件  html  ASP.NET 漫
当前位置 :| hh85>开发代码>asp>

ASP无限分类的实现代码

来源: 作者: 时间:2008-02-21 点击:
目录树的构成:

数据表仅仅用typeid,typename,fatherid三列实现. 新 骑 兵 www.pcfancs.com.cn

<%
set Rs=server.CreateObject("adodb.recordset")
Rs.open "Select * From cls where fatherID='0'",conn,1,1 '查询根目录,即父目录为0
%>
<select name="fatherid" id="fatherid">
<option value="0" selected>请选择栏目</option>
<%
do while Not Rs.eof
Response.Write ("<option value="""&Rs("typeid")&""">"&Rs("typename")&"</option>"&chrb(13) & chrb(10)) '输出
call subtree("┠",Rs("typeid")) '调用当前目录下所有子栏目
Rs.movenext
loop
rs.close
%>
</select>
<%
Sub subtree(tree,t_id) '这个子程序是实现子栏目调用的.

set rs1=conn.execute("Select * from cls where fatherID='"&t_id&"'") 查询父目录为t_id的所有栏目.
do while Not Rs1.eof
Response.Write ("<option value="""&Rs1("typeid")&""">"&tree&Rs1("typename")&"</option>"&chrb(13) & chrb(10))
call subtree(tree&"┝",Rs1("typeid")) '调用当前栏目的所有子栏目!
rs1.movenext
loop
rs1.close
set rs1=nothing
End sub
%>
TAG :
最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册
栏目列表