Dean said:
Hi
I've got a question relating to using Javascript on an Intranet. I
have a directory with a list of files in the format week36.xls,
week37.xls
and I want to write a script that will scan all the files in the
directory and select the one with the highest week number then display
in the browser window. A brief search hasn't revealed any code to do
this so I just want to know if it is possible and what the function
names are that would be involved.
Cheers
Dean
Client-side JavaScript, by itself, in the default security environment has
no access to the names of files in a directory on a web server. Without
some help from the server, client-side JavaScript by itself is unable to
retrieve a "directory listing". With the server's help (by simply listing
the contents of a directory when you request
http://yourserver/yourexcelfiles/, or by returning a page that lists the
contents of the directory) client-side JavaScript might have a chance of
loading that directory listing into a hidden iframe and parsing the
results. Of course, if you have server-side technology at your disposal to
generate such a list, then you could simply use that server-side
technology to choose the file with the newest date and display a link to
it, no client-side JavaScript would be required at all.
If you need to rely on a purely client-side solution, then you might be
able to make use of the Java applet available at:
<url:
http://www.galasoft-lb.ch/myjava/WebLoadFile/Demo/Demo.html />
But honestly, choosing a file from a directory on the server with specific
attributes and returning it to the browser is better suited to server-side
processing.
--
| Grant Wagner <
[email protected]>
* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html
* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp
* Netscape 6/7 DOM Reference available at:
*
http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
*
http://www.mozilla.org/docs/web-developer/upgrade_2.html