ASP implements structured enumeration and view all files under a path

Source: Internet
Author: User
Tags count

<! Web page ASP code, you can implement a structured enumeration and look at a path to all the files, can be used to dynamically generate site maps, specific cases please see my homepage map: http://freehost08.websamba.com/hzhzhz/sitemap.htm>
<! Author: Tongji Huangzhengfeng http://websamba.com/hzhzhz/Application Please specify the source >
<style This style sheet must be retained >
<!--
U.{background-color:fedc76;cursor:hand;}
a{background-color:97ef53;}
font{padding-bottom:0;padding-top:0;margin-bottom:0;margin-top:0;}
-->
</style>
<title> Site Map </title>
<body>
<span id=shhi style= "text-align:right;width:20%;p osition:absolute;bottom:0" >
<a href=# onclick= ' jscript:if (rightf.style.display== "") rightf.style.display= "none"; else rightf.style.display= " "; return false ' Style=background-color:red>hide/show =></a>
</span>
<div ID=RIGHTF style= "height:100%;width:80%;p osition:absolute;right:0;top:0" >
<iframe align=right name= "right" Scrolling=auto style= "height:100%;width:100%" src= "About:blank" > </iframe >
</div>
<base target= "Right" >


<script language=vbscript>
<!--

Sub Window_onscroll ()
Rightf.style.pixeltop=document.body.scrolltop
Shhi.style.top=document.body.clientheight+document.body.scrolltop-30
End Sub

Sub Dofold (index) ' shows and hides a node's process
Dim itm
Set Itm=eval ("Divfold" & Index)
If itm.style.display= "None" then
Itm.style.display= ""
Else
Itm.style.display= "None"
End If
Set itm = document.all (itm.sourceindex-2)
If itm.innertext= "0" Then
itm.innertext= "1"
Else
itm.innertext= "0"
End If
Set Itm=document.all ("ITMJJ" & Index)
If not itm are nothing Then
If itm.innertext= "+" then
itm.innertext= "-"
Else
itm.innertext= "+"
End If
End If
End Sub

-->
</Script>


<%
'------ASP Program segment--------------------------------------
Set Fso=server.createobject ("Scripting.FileSystemObject") ' Server must support FSO

Dim Path,mappath
If Request ("path") = "" Then
Path= "" ' must first set the name of the folder you want to view, that is, the path= path name, such as setting path= "Hzhzhz" when you want to view the http://websamba.com/hzhzhz/
Else
Path=request ("path") can be set as follows: <a href= "Dirpath.asp?path=hzhzhz".
End If
Mappath=server.mappath ("/" & Path)

If Fso.folderexists (MapPath) =false Then
Response.Write "Path: http://" & Request.ServerVariables ("Http_host") & "/" & Path & "does not exist!"
Response.End
End If

Dim Tf
Tf=0
Sub Dirthisfolder (fo,strhead) ' Recursive process, program author: Tongji Huangzhengfeng http://websamba.com/hzhzhz/
If not FSO. FolderExists (Fo) then Exit Sub
Dim Fon,fin,tt
Set Folde = Fso.getfolder (Fo)
Fon=folde.subfolders.count
Fin=folde.files.count

tt= "<u lab=" contains "& FoN &" subfolders, "& FiN &" Sub file "Onclick=dofold (" & TF & ") >"
If FoN then Tt=tt & "<q id=itmjj" & TF & ">+</q>"
Tt=tt & "<font face=wingdings>0</font>" ' icon-like characters
If Len (strhead) Then
If Fin>0 Then
Response.Write Left (Strhead,len (Strhead)-1) & "├" & Tt & Folde.name & "</u><br>"
Else
Response.Write Left (Strhead,len (Strhead)-1) & "├" & Tt & Folde.name & "</u><br>"
End If
Else
Response.Write "" & Tt & Folde.path & "</u><br>"
End If


Response.Write "<span id=divfold" & TF & "style=" "Display:none" ">"
TF=TF +1
If FoN Then
I=0
For each Fol in Folde.subfolders
Islastfol= (i=fon-1)
If FiN > 0 Then



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.