I wrote a recursive code that generates a tree-like menu that works like Windows Explorer, please correct me.

Source: Internet
Author: User
Tags chr trim
window| Menu | recursion <HTML>
<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= "";

{ss.style.display= "none";
Aa.style.display= "None";

function Onlyclose (SS,II,AA)
Ss.style.display= "None";
Aa.style.display= "None";
<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
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>" & C

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.