[Javascript] find folder

Andrew Dunn adunn at mail.interworx.com.au
Tue Jul 31 19:28:42 CDT 2001


Hi,
   I'm trying a few things with this ActiveX filescripting object. I have
code that displays all the files in a set folder (quotes). This code works
fine when it is just on the desktop but when I move both the quotes folder
and the code to another directory (they are still in the same folder) I have
an error occuring saying it can not find the path. Can anyone see the error
in my code below?


<html><head>
<title></title>
<script language=JScript>
<!--
var obj_fso;
var obj_folder;
var files;
obj_fso = new ActiveXObject("Scripting.FileSystemObject");
obj_folder = obj_fso.GetFolder("quotes");
files = new Enumerator(obj_folder.files);

function opn_file(file_name) {
	window.location= 'file:///' + file_name;
}
//--end-->
</script>
</head>
<body text='#000000' bgcolor='#ffffff'>
<script language="JScript">
<!--
for (;!files.atEnd(); files.moveNext())
  {
   document.write("<INPUT type='button' value='" + files.item() + "'
onclick='opn_file(this.value)'><P>");
  }
//--end-->
</script>
</body></html>




Thanks,

Andrew




More information about the Javascript mailing list