Use ACCESS to create a database listBase. mdb:
Data table: listTable
Data Field: listId listName listInfo parentId connection method:
<%
Dim sConn, sConnStr, sSql
SConnStr = "DRIVER = {Microsoft Access Driver (*. mdb)}; dbq =" & server. mappath ("listBase. mdb ")
Set sConn = server. createobject ("adodb. connection ")
SConn. open sConnStr
%>
Save the above code as a file: initialize. asp the following program code is used to display the directory tree and save it as a file: inc. asp
<! -- # Include file = "initialize. asp" -->
<Script language = jscript>
<! --
// This function is used to display and close its sub-menu, and switch the small image above it
Function showMenu (menuObj, isSub ){
If (menuObj. style. display = "none "){
MenuObj. style. display = "";
If (isSub = 1 ){
Event. srcElement. src = "images/open.gif ";
}
}
Else {
MenuObj. style. display = "none ";
If (isSub = 1 ){
Event. srcElement. src = "images/close.gif ";
}
}
}
// -->
</Script>
<! -- The following blue area sets the root of the directory tree. The content is not the data in the data, and the data in the database is attached to it. // -->
<%
Response. write ("<table width = '000000' 'border = '0' 'cellspacing = '0' 'cellpadding = '0'>" & chr (13))
Response. write ("<tr>" & chr (13) & "<td>" & chr (13) & "<table width = '000000' 'border = '0' 'cellspacing = '0' 'cellpadding = '0'> ")
Response. write ("<tr>" & chr (13) & "<td width = ''18''> </td>" & chr (13) & "<td width = '000000' class = ''menupro'' id = ''listname0''> root node </td>" & chr (13 ))
Response. write ("<td width = ''40'' class = ''menufont'' align = ''center'' style = ''cursor: hand ''onclick = "" jscript: showForm (''add'', 0) ""> add </td> "& chr (13 ))
Response. write ("<td width = ''40'' class = ''menufont'' align = ''center'' onclick = '''> </td>" & chr (13 ))
Response. write ("<td> & nbsp; </td> </tr> </table> </td> </tr>" & chr (13 ))
Response. write ("<tr id = ''submenu0''>" & chr (13) & "<td colspan = ''2'>" & chr (13 ))
''Call the recursive function to display the directory tree.
ListChild (0)
Response. write ("</td>" & chr (13)
<