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/y/"minus.gif";
}
else
{ss.style.display="none";
aa.style.display="none";
ii.src=http://www.163design.net/a/y/"http://www.163design.net/a/y/plus.gif";}
}
function onlyclose(ss,ii,aa)
{
ss.style.display="none";
aa.style.display="none";
ii.src=http://www.163design.net/a/y/"http://www.163design.net/a/y/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>" & chr(10)
else
'*1.显示本项内容
response.write "<TR>" & chr(10)
response.write "<TD language=JScript onmouseup=turnit(" & _
"Content" & IDIndex & "," & _
"img" & IDIndex & "," & _
"Aux" & IDIndex & ");>" & chr(10)
response.write "<IMG height=9 id=img" & IDIndex & " src='http://www.163design.net/a/y/plus.gif' width=9>" & chr(10)
response.write "</TD>" & chr(10)
response.write "<TD>" & chr(10)
response.write "<A href='Frame_4_publish.asp?DocTypeID=" & _
NodeID & "' target='frmFour'>" & NodeName & _
"</A>" & chr(10)
response.write "</TD>" & chr(10)
response.write "</TR>" & chr(10)
'*2.输出子孙树头代码
response.write "<TR>" & chr(10)
response.write "<TD id=Aux" & IDIndex & " style='display: none'> </TD>" & chr(10)
response.write "<TD id=Content" & IDIndex & " style='display: none'>" & chr(10)
response.write "<TABLE border='0'>"
IDIndex = IDIndex + 1
'*3.输出子孙树代码
call DoItem(OlderSon)
'*4.输出子孙树尾代码
response.write "</TABLE>"
response.write "</TD>" & chr(10)
response.write "</TR>" & chr(10)
end if
if YoungerBrother <> "" and YoungerBrother <> "00" then
call DoItem(YoungerBrother)
end if
rsTest.close
set rsTest = nothing
end Sub
response.write "<table border='0'>"
call DoItem("01")
response.write "</table>"
dbConn.close
set dbConn = nothing
%>
</BODY>
</HTML>