类似于iis浏览的功能

2016-01-29 20:02 16 1 收藏

类似于iis浏览的功能,类似于iis浏览的功能

【 tulaoshi.com - ASP 】

<!---将此文件存为folder_list.asp看看效果就知道了加上权限就可以方便自己了,---
<%
'const_domain_name为域名最后不要加斜杠
const const_domain_name="http://localhost"
%
<style
b,img,a{font-size:9pt;line-height:150%;text-decoration:none;color:#0000cc;}
span{font-size:12pt;}
</style

<%
'------------------------------------------------显示当前目录下的子目录和文件
sub list
Dim fso, f, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(server.MapPath("."))
set fs=f.SubFolders
Set fc =f.Files

For Each fss in fs
dim folder_name
folder_name=fss.name
%
<a href="folder_list.asp?act=list_cur&cur_path=<%=fss%"<span style="font-family:wingdings"0</span<%=folder_name%</a<br
<%
Next

%
<%
For Each f1 in fc
dim filename
filename=f1.name
%
<a href="<%=p2v_path(f1)%"<span style="font-family:wingdings 2"/</span<%=filename%</a<br
<%
Next

set fso=nothing
end sub
%


<%
'------------------------------------------------显示指定路径下的目录和文件
sub list_cur
Dim fso, f, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(request("cur_path"))
set fs=f.SubFolders
Set fc =f.Files

For Each fss in fs
dim folder_name
folder_name=fss.name
%
<a href="folder_list.asp?act=list_cur&cur_path=<%=fss%"<span style="font-family:wingdings"0</span<%=folder_name%</a<br
<%
Next

%


<%
For Each f1 in fc
dim filename
filename=f1.name
%
<a href="<%=p2v_path(f1)%"<span style="font-family:wingdings 2"/</span<%=filename%</a<br
<%
Next
set fso=nothing
end sub
%



<%
'------------------------------------------------显示上级目录的子目录和子文件
sub list_parent
on error resume next
Dim fso, f, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(display_cur_path)
set fs=f.SubFolders
Set fc =f.Files

For Each fss in fs
dim folder_name
folder_name=fss.name

%
<a href="folder_list.asp?act=list_cur&cur_path=<%=fss%"<span style="font-family:wingdings"0</span<%=folder_name%</a<br
<%

Next

%

<%
For Each f1 in fc
dim filename
filename=f1.name
%
<a href="<%=p2v_path(f1)%"<span style="font-family:wingdings 2"/</span<%=filename%</a<br
<%
Next
set fso=nothing
on error goto 0
end sub

'---------------------------------------------得到上级目录的路径
function get_parent_folder()
on error resume next
str=display_cur_path
str_find=""
str_int=InStrRev (str,str_find)-1 '得到上一级目录的路径
get_parent_folder=mid(str,1,str_int)
err.clear
end function


'-----------------------------------------------将文件路径转为www发布的路径这样就可以下载了
function p2v_path(p_path)
'p_path为硬盘上的物理路径
dim host
host=lcase(server.MapPath(""))
p_path=lcase(p_path)
p2v_path=replace(p_path,host,const_domain_name)
end function

'-----------------------------------------------显示当前所在的路径
function display_cur_path()
cur_path=request("cur_path")
if cur_path="" then
display_cur_path=server.MapPath(".")
else
display_cur_path=cur_path
end if
set fso=nothing
end function

sub main
%
<a href="folder_list.asp?act=list_parent&cur_path=<%=get_parent_folder%"向上</a <b<a href="javascript:void(null)"<%=display_cur_path%</a</B<p
<%

select case request("act")
case "list_parent"
list_pa

来源:https://www.tulaoshi.com/n/20160129/1510598.html

延伸阅读
标签: Web开发
熟悉Ajax的人应该都知道DWR这个开源框架,它让Ajax程序开发变得简单,但是目前好像只能支持Java,今天就来说一下我在Asp.Net项目中怎样模拟实现DWR的功能: 创建一个接口(姑且叫做IWAjaxEngine),其作用定义对Ajax暴露的方法,我设计的是一个返回string类型的方法,还有一个是没有返回值的方法,两个方法的参数都是Dictionarystring, string类...
标签: SQLServer
  我们经常在设计数据库的时候用一个系统自动分配的ID来作为我们的主键,但是在ORACLE 中没有这样的     功能,我们 可以通过采取以下的功能实现自动增加ID的功能      1.首先创建 sequence          create sequence seqmax increment ...
标签: Web开发
代码如下: html head title类似框架的JS导航菜单/title meta http-equiv=content-Type content="text/html;charset=gb2312" !--把下面代码加到head与/head之间-- SCRIPT language=JavaScript             function secBoard(n)    &n...
标签: 浏览器
360极速浏览器浏览器头像的功能 1.登录网络帐户 点击浏览器头像可登录360帐户。登录360帐户的状态下,您的收藏夹、浏览器配置的修改都将自动备份到360帐户中。之后随 时登录360帐户即可自动上述内容同步到浏览器中。 2.更换头像 您可以在头像菜单里选择您喜欢的头像,用于装饰浏览器。陆续将提供更多精美的头像供您选用。 ...
相信大家在QQ空间中浏览照片时都习惯了单击图片左边观看上一张,单击图片右边则观看下一张,这种浏览方式确实很独特。最近在论坛上也有看到网友们设计的“点小图 看大图”只为在WPS演示中提供一种时尚快捷的浏览方式。那么重点来了,如何在WPS演示中实现这一浏览效果呢?经搜索研究发现,其实很简单的只需利用“动作设置”...

经验教程

190

收藏

92
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部