window| Menu | recursion <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
' Establish a database connection
Set dbconn = Server.CreateObject ("Adodb.connection")
Dbconn.open "Driver={microsoft Access DRIVER (*.mdb)}; Dbq= "& Server.MapPath (" Test.mdb ")
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Generate recursive function of file type tree, passed in parameter: Nowitem as tree Node ID '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub Doitem (Nowitem)
Dim rstest
Dim Youngerbrother ' ID of the next sibling node
Dim Olderson ' The ID of the first word node
' Set up a recordset
Set rstest = Server.CreateObject ("Adodb.recordset")
' Generate SQL statements, manipulate doc_typetree tables
strSQL = "SELECT * from tab_test where ID = '" & Nowitem & "'"
' Generate a Recordset
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") & "")
' Show child nodes
If Olderson = "" or Olderson = "then" When this item has no subkeys, output the corresponding code
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. Show the contents of this item
Response.Write "<TR>" & Chr (10)
Response.Write "<td language=jscript Onmouseup=turnit (" & _
"Content" & Idindex & "," & _
"img" & Idindex & "," & _
"Aux" & Idindex & ");>" & Chr (10)
Response.Write " '" & 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. Export Descendants Tree Header code
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. Output descendants Tree code
Call Doitem (Olderson)
' *4. Output descendants tree Tail code
Response.Write "</TABLE>"
Response.Write "</TD>" & Chr (10)
Response.Write "</TR>" & Chr (10)
End If
If Youngerbrother <> "" and Youngerbrother <> "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>