js如何遍历本地目录的文件 不用FSO
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了js如何遍历本地目录的文件 不用FSO相关的知识,希望对你有一定的参考价值。
参考技术A <html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script>
function searchFiles()
var fso = new ActiveXObject("Scripting.FileSystemObject");
var f = fso.GetFolder(document.all.fixfolder.value);
var fc = new Enumerator(f.files);
var s = "";
for (; !fc.atEnd(); fc.moveNext())
s += fc.item();
s += "<br/>";
fk = new Enumerator(f.SubFolders);
for (; !fk.atEnd(); fk.moveNext())
s += fk.item();
s += "<br/>";
textarea.innerHTML = s
</script>
</head>
<body bgcolor="#FFFFFF">
指定文件夹:<input type="text" name="fixfolder" value ="E:\J2EE">
<input type="button" value ="搜索" onclick="searchFiles()">
<table >
<tr>
<td id = "textarea">
</td>
</tr>
</table>
</body>
</html>
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/jackeyabc/archive/2007/01/15/1483663.aspx 参考技术B function searchFiles()
var fso = new ActiveXObject("Scripting.FileSystemObject");
var f = fso.GetFolder(document.all.fixfolder.value);
var fc = new Enumerator(f.files);
var s = "";
for (; !fc.atEnd(); fc.moveNext())
s += fc.item();
s += "<br/>";
fk = new Enumerator(f.SubFolders);
for (; !fk.atEnd(); fk.moveNext())
s += fk.item();
s += "<br/>";
textarea.innerHTML = s
以上是关于js如何遍历本地目录的文件 不用FSO的主要内容,如果未能解决你的问题,请参考以下文章