向高手求救!关于变量保留传递的问题!
想写个基于FSO的文件管理起!但是返回上一目录中遇到到难题!请高手指点!这里返回上一级目录老是出错!还有获取跟目录文件夹也有问题!这是演示地址:http://yuzhuang.host001.
程序代码:
<script language=javascript> function chfolder(selectitem){ form=document.forms[0]; form.selectItem.value=selectitem; form.submit(); } </script> <% Dim fs, f, f1, s, sf set fs=server.CreateObject("scripting.filesystemobject") on error resume next path="d:\e8088\echsop" hostdir="" selectItem=Request("selectItem") hostdir=Request("hostdir") hostdir2=hostdir+"\"+selectItem basedir=request("basedir") if basedir="" then set f=fs.GetFolder(path) else if selectItem=".." then lastbasedir=basedir set f=fs.GetFolder(lastbasedir) else path=basedir+"\"+selectItem set f=fs.GetFolder(path) end if end if set sf=f.SubFolders %> <table width="800" border="0" align="center" cellpadding="0" cellspacing="0" > <form name=form1 method=post action="fso.asp"/> <input type=hidden name="selectItem" value=""/> <input type=hidden name="basedir" value="<%=path%>" /> <input type=hidden name="hostdir" value="<%=hostdir2%>" /> <tr > <td colspan="3" background="image/floder_top.gif" height="26">?</td> </tr> <tr> <td background="image/floder_left.gif" width="7" ></td> <td> <table width="100%" border="0" bgcolor="#FFFFFF" cellpadding="0" cellspacing="0"> <tr> <td height="33" colspan="5" valign="middle" background="image/dir_back.gif"> <table width="100%" height="24" border="0" cellpadding="0" cellspacing="0"> <tr> <td valign="middle" width="24"><img src="image/back_floder.gif" width="24" height="24" border="0" /></td> <td width="110" ><a href="javascript:chfolder('..');" title="返回上级目录">返回上级目录</a></td> <td width="44" style="border:0px;" background="image/dir_left.gif"></td> <td background="image/dir_middle.gif" width="560" style="border:0px;"><%=hostdir2%></td> <td width="44" style="border:0px;" background="image/dir_right.gif"></td> </tr> </table> </td> </tr> <tr> <td background="image/type.gif" >??名称</td> <td align="right" background="image/type.gif" height="33">大小</td> <td background="image/type.gif" >????</td> <td align="left" background="image/type.gif">类型</td> <td align="left" background="image/type.gif">修改时间</td> <% For Each f1 in sf %> </tr> <tr> <td> ??<a href="javascript:chfolder('<%=f1.name%>');" title="点击选择文件夹<%=f1.name%>"><img src="image/folder.gif" width="16" height="16" border="0"/><%=f1.name%></a> </td> <td align="center"></td> <td>????</td> <td align="left"><%=f1.Type%></td> <td align="left"><%=f1.DateLastModified%></td> </tr> <% 'bianli(nowpath)'递归 next %> <% set objFiles=f.Files for each objFile in objFiles %> <tr> <td>??<%=objFile.name%></td> <td align="right"> <% if (objFile.Size\1024)<>"0" then Response.Write(objFile.Size\1024&"Kb") else Response.Write(objFile.Size&"K") end if %> <td>????</td> <td align="left"><%=objFile.Type%></td> <td align="left"><%=objFile.DateLastModified%></td> </tr> <% next set f1=nothing set f=nothing set fs=nothing 'end function %> </table> </td> <td background="image/floder_right.gif" width="7"></td> </tr> <tr> <td colspan="3" background="image/floder_bottom.gif" height="77">?</td> </tr> </table>
[[it] 本帖最后由 loveaoao 于 2008-4-23 19:47 编辑 [/it]]