Use DW to write a directory tree with ASP + ACCESS

Source: Internet
Author: User
Tags chr

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)

<
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.