读书人

列出全部目录

发布时间: 2012-11-23 00:03:43 作者: rapoo

列出所有目录

<html><head><meta http-equiv="content-type" content="text/html; charset=gb2312"><title>FileList with VBScript&Javascript</title><script type="text/vbscript">on error resume next Function Mappath(v) Mappath=fso.getAbsolutePathName(v)End Function Function getPath(style,path)pathlist="<select style=""float:left;"&style&""" ondblclick=""javascript:FileMan(this.value)"">"if path="" or not fso.folderexists(path) thenpathlist=pathlist+"<option value="""">我的电脑</option>"for each xx in fso.drivespathlist=pathlist&"<option value="""&xx&""">"&xx&"\</option>"nextelseset fpo=fso.getfolder(path)'pathlist=pathlist&"<option value="""&path&""">当前目录==>"&path&"</option>"if len(path)>3 thenpathlist=pathlist&"<option value="""&fpo.parentfolder&""">..</option>"elsepathlist=pathlist&"<option value="""">我的电脑</option>"end iffor each xx in fpo.subfoldersif i=0 then x=" selected" else x=""i=1pathlist=pathlist&"<option value="""&xx&""" title="""&xx&""""&x&">"&xx&"</option>"nextpathlist=pathlist&"</select><select style=""float:left;"&style&""" ondblclick=""javascript:openFile(this.value);"">"for each xx in fpo.filesif i=0 then x=" selected" else x=""j=1pathlist=pathlist&"<option value="""&xx&""" title="""&xx&""""&x&">"&xx&"</option>"nextend ifpathlist=pathlist&"</select>"getPath=pathlistEnd Function Sub LoadingFileMan("D:")DriversMan()End Sub function openFile(v)window.open vend function set fso=CreateObject("Scripting.FileSystemObject")</script><script type="text/javascript">function gettextarea(){ores=document.getElementById("res");}function getV(_id,ji){var sel=document.getElementsByTagName("select")[ji];sel.uid=_id;sel.onchange=function(){for(i=0;i<sel .options.length;i++){if(sel.options[i].selected!=""){document.getElementById(sel.uid).value=sel.options[i].value;}}}}function _ch(id){getV(id,1);}function _chf(id){getV(id,2);}function FileMan(Path){var oFm=document.getElementById("fileman");oFm.innerHTML=getPath("width:90%;\"  size=\"13",Path);}function DriversMan(){var oDm=document.getElementById("driversman");oDm.innerHTML=getPath("width:9%;\"  size=\"26","");}</script></sel></script></meta></head><body style="background:#D4D0C8;text-align:center" onload="Loading"><div style="width:100%;height:100%"><div><span id="driversman"></span><span id="fileman"></span></div><div><input value="请点击选择目录" onclick="javascript:_ch(this.id);" id="__rst" readonly/><input value="请点击选择目录"  onclick="javascript:_ch(this.id);" id="__res"  readonly/><input value="请点击选择文件" onclick="javascript:_chf(this.id);" id="__rstf" readonly/><input value="请点击选择文件"  onclick="javascript:_chf(this.id);" id="__resf"  readonly/><input value="请点击选择目录" onclick="javascript:_ch(this.id);" id="__rst1" readonly/><input value="请点击选择目录"  onclick="javascript:_ch(this.id);" id="__res1"  readonly/><input value="请点击选择文件" onclick="javascript:_chf(this.id);" id="__rstf1" readonly/><input value="请点击选择文件"  onclick="javascript:_chf(this.id);" id="__resf1"  readonly/><input value="请点击选择目录" onclick="javascript:_ch(this.id);" id="__rst2" readonly/><input value="请点击选择目录"  onclick="javascript:_ch(this.id);" id="__res2"  readonly/><input value="请点击选择文件" onclick="javascript:_chf(this.id);" id="__rstf2" readonly/><input value="请点击选择文件"  onclick="javascript:_chf(this.id);" id="__resf2"  readonly/></div></div></body></html>

?

读书人网 >Web前端

热点推荐