如下html page里的一段javascript code:
<html> <head> <script language="javascript"> var s = ""; function ShowFolderFileList(i,folderspec) { /* var fso,f,fc,name; var url,str,file,filename; var i; fso = new ActiveXObject("Scripting.FileSystemObject"); f = fso.GetFolder(folderspec); s += i++ + "\t" + f.Name + "\t\n"; fc = new Enumerator( f.files ); for (; !fc.atEnd(); fc.moveNext( ) ) { filename = fso.GetFileName( fc.item( ) ); console.log("file name: " + filename); } fc = new Enumerator(f.SubFolders); for (; !fc.atEnd(); fc.moveNext()) { ShowFolderFileList(i,fc.item()); } return( s ); */ console.log(i); console.log(folderspec); } </script> </head> <body onload = ShowFolderFileList('test', 'c:\\temp')></body> </html>