LINE9的目录浏览源程序
程序员文章站
2022-10-28 10:26:32
复制代码 代码如下:<%' make sure you have the 6 dir_*.gif files!' yes, you can copy ours if...
复制代码 代码如下:
<%
' make sure you have the 6 dir_*.gif files!
' yes, you can copy ours if ya want too.. :)
' http://line9.com/img/dir_dir.gif .. etc.
function showimagefortype(strname)
strtemp = strname
if strtemp <> "dir" then
strtemp = lcase(right(strtemp, len(strtemp) - instrrev(strtemp, ".", -1, 1)))
end if
select case strtemp
case "dir"
strtemp = "dir"
case "asp"
strtemp = "asp"
case "htm", "html"
strtemp = "htm"
case "gif", "jpg", "jpeg", "png", "tif", "cpt", "bmp", "pcx", "tga", "psd", "eps"
strtemp = "img"
case "txt", "text", "dat", "bat", "sys"
strtemp = "txt"
case else
strtemp = "misc"
end select
strtemp = "<img src=""img/dir_"&strtemp&".gif"" width=16 height=16 border=0>"
showimagefortype = strtemp
end function
tek9 = request.querystring("tek9")
if tek9 = "" then strpath = "mydirectory/" else strpath = tek9
set objfso = server.createobject("scripting.filesystemobject")
set objfolder = objfso.getfolder(server.mappath(strpath))
response.write"<b>view our files and folders here:</b><br>"&_
"<table border=0><tr><td colspan=2>"&_
"<img src=""img/dir_dir_open.gif"" width=16 height=13 border=0> <font face=arial
size=2><b>"&strpath&"</b></font></td></tr>"
for each objitem in objfolder.subfolders
if instr(1, objitem, "_vti", 1) = 0 then
response.write"<tr><td><font face=arial size=2> "&showimagefortype("dir")&" "&_
"<a href=""myfile.asp?tek9="&strpath&objitem.name&"/"">"&_
""&objitem.name&"</a></font></td><td> </td></tr>"
end if
next
for each objitem in objfolder.files
response.write"<tr><td><font face=arial size=2>"&_
" "&showimagefortype(objitem.name)&" "&_
"<a href="""&strpath&objitem.name&""">"&objitem.name&"</a></font></td>"&_
"<td align=right><font face=arial size=2>"&objitem.size&"</font></td></tr>"
next
set objitem = nothing
set objfolder = nothing
set objfso = nothing
response.write"</table>"
%>
上一篇: 随机森林学习笔记(未完待续)
下一篇: Python语法基础学习_列表 元组