以下是完整的网页代码:
<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())
{
document.write(fc.item()+"<br>");
;
}
//以下内容是显示目录名
fk = new Enumerator(f.SubFolders);
for (; !fk.atEnd(); fk.moveNext())
{
document.write(fk.item()+"<br>");
}
;
}
</script>
</head>
<body bgcolor="#FFFFFF">
指定文件夹:<input type="text" name="fixfolder" value ="d:/2008/">
<input type="button" value ="搜索" οnclick="searchFiles()">
<table >
<tr>
<td id = "textarea">
</td>
</tr>
</table>
</body>
</html>