window|菜单|递归<HTML>
<HEAD>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<SCRIPT lanuage="JScript">
function turnit(ss,ii,aa)
{
if (ss.style.display=="none")
{ss.style.display="";
aa.style.display="";
ii.src=http://www.163design.net/a/q/"minus.gif";
}
else
{ss.style.display="none";
aa.style.display="none";
ii.src=http://www.163design.net/a/q/"plus.gif";}
}
function onlyclose(ss,ii,aa)
{
ss.style.display="none";
aa.style.display="none";
ii.src=http://www.163design.net/a/q/"plus.gif";
}
</SCRIPT>
</HEAD>
<BODY bgColor=#99CCFF>
<%
dim dbConn
dim IDIndex
IDIndex = 0
'建立数据库连接
Set dbConn = Server.CreateObject("Adodb.Connection")
dbConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath ("test.mdb")
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''生成文件类型树的递归函数,传入参数:NowItem为树节点的ID ''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub DoItem(NowItem)
dim rsTest
dim YoungerBrother '下一个兄弟节点的ID
dim OlderSon '第一个字节点的ID
'建立记录集
set rsTest = Server.CreateObject("Adodb.recordset")
'生成sql语句,操作Doc_TypeTree表
strSql = "select * from tab_test where ID = '" & NowItem & "'"
'生成记录集
rsTest.open strSql,dbConn,1,3
if rsTest.eof then
rsTest.close
set recDosType = nothing
exit sub
end if
YoungerBrother = trim(rsTest("BrotherNode") & "")
OlderSon = trim(rsTest("SonNode") & "")
NodeID = trim(rsTest("ID") & "")
NodeName = trim(rsTest("NodeName") & "")
'显示子节点
if OlderSon = "" or OlderSon = "00" then '当此项无子项时,输出相应的代码
response.write "<TR>" & chr(10)
response.write "<TD> </TD>" & chr(10)
response.write "<TD>"
response.write "<A href='test'>" & NodeName & "</A>"
response.write "</TD>" & chr(10)
response.write "</TR>" & c
我写的一段递归生成类似Windows资源管理器一样效果的树状菜单的
80酷酷网 80kuku.com