JS怎么实现查询本机目录下所有文件名称的功能.
JS怎么实现查询本机目录下所有文件名称的功能.
s = " "
folderspec = "F:\Mywork\asp "
Set fso = CreateObject( "Scripting.FileSystemObject ")
Set f = fso.GetFolder(folderspec)
Set fc = f.SubFolders
For Each f1 in fc
s = s & f1.name & VbCrLf
s = s & " <BR> "
Next
Set fc = f.Files
For Each f1 in fc
s = s & f1.name & VbCrLf
s = s & " <BR> "
Next
Respons.Write s
谁知道这段代码用JS怎么实现?
------解决方案--------------------可以用JSP来实现嘛
//获取当前站点所在目录
String sPath=request.getRealPath( "/ ");
//建立当前目录中文件的FILE对象
File fObj=new File(sPath);
//
File fObjList[]=fObj.listFiles();
for(int i=0;i <fObjList.length;i++)
{
String sFileName=sPath+fObjList[i].getName();
}