无限极分类

表结构
title

title

代码如下

<!--#include file="conn.asp"-->
<%
set rs1=server.createobject("adodb.recordset") 
sql1="select * from Goods_class where parentid=0 order by sortID" 
rs1.open sql1,conn,1,1 
if rs1.eof or rs1.bof then 
response.write"还没分类!" 
else 
while not rs1.eof 
id1=rs1("sortID") 
name1=rs1("sortname") 

response.write "*<a href='class.asp?id="&id1&"&name="&name1&"'>"&name1&"</a>d.add(0,-1,'My example tree');<br>"
parentid1=rs1("parentid") 
call reclass(id1) 
rs1.movenext 
wend 
end if 
rs1.close 
set rs1=nothing 

 
sub reclass(id) 
'递归调用函数,生成一个类别代码 
set rs=server.createobject("adodb.recordset") 
sql="select * from Goods_class where parentid="&id 
rs.open sql,conn,1,1 
i=1
while not rs.eof 
id0=rs("sortID") 
classname0=rs("sortname") 
parentid0=rs("parentid") 
'classdepth0=rs("classdepth")
classdepth0=split(rs("sortpath"),",")

brstr=""
for j=1 to Ubound(classdepth0)
brstr=" "&brstr
next 
response.write(brstr&"└<a href='class.asp?id="&id0&"&name="&classname0&"'>"&classname0&"</a><br>")
call reclass(id0) 

rs.movenext 
i=i+1
wend 
rs.close 
set rs=nothing 
end sub
%>

Tags:web  JavaScript  JS  Asp  
点击这里获取该日志的TrackBack引用地址
收藏到网摘:
分类: Web技巧 | 评论: 0 | 引用: 0 |

相关文章:
ie浏览器下的js脚本调试工具 Microsoft Script Debugger收藏  (2009-5-9 23:1:47)
合同错误  (2009-5-5 19:13:35)
js replace 使用  (2009-4-27 16:31:50)
js 获取 option 显示内容  (2008-11-28 11:3:32)
Location.reload 详解  (2008-11-21 16:31:59)
如何在Web页面上直接打开、编辑、创建Office文档   (2008-11-6 23:38:52)
用js如何判断div的内容是否为空  (2008-11-3 12:40:40)
ASP两种生成静态文件时如何设定编码输出格式  (2008-11-1 10:3:9)
让回调函数 showResponse 也带上参数  (2008-10-23 16:7:54)
汉字转拼音(JS版)  (2008-10-20 14:0:54)

Name(*):
Mail:
Website:
Verify(*): 看不清,就点我!
Content(*):