Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Slide that get graphics files from directory

Status
Not open for further replies.

BigKeeya

Programmer
Nov 8, 2003
6
0
0
US
I'm sure many of you out there know the answer to this, but unfortunately I do not. I am attempting to create a slide show using HTML and JavaScript. I want it to produce a slide show with all the pictures in a directory. However, I have not been able to find an example in javaScript that does not require me to include the name of the graphics file in the code or use a consistent naming structures (e.g., picture0.jpg, picture1.jpg, etc.) knowing the exact number of files in the directory.

Is there a way to get javaScript to scan a directory and then place the contents in an array?

 

If you mean client-side JavaScript, where the images reside on a user's PC, then the only way I can think of would be to use the FileSystemObject ActiveX control, but this would limit you to running on IE/Win only.

If you mean server-side JavaScript (ASP), where the images are stored on the server, then the same control could be used, but there would be no such browser restrictions.

I cannot think of any other easy ways that this can be achieved.

Hope this helps,
Dan
 
I have the same question as BigKeeya - I want to have code on my own website that will take a directory reference (ex: "\images\") and scan that directory and load the filenames into an array w/o having to spell out the actual filenames in the code.

BillyRay points to the FileSystemObject control, but I've researched it a little and can't figure out how to incorporate it into my HTML/Jscript code.

Is there an example of this that I can use?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top