Forum Moderators: open

Message Too Old, No Replies

onclick image swap loop

is it possible to call all images in a folder?

         

aevea

5:45 am on Dec 19, 2003 (gmt 0)

10+ Year Member



I'm trying to write a script that will swap *all* the images in a folder sequentially onclick no matter how many there are. The document structure is extremely simple and the images are too large to worry about preloading.

The problem is that I'm a complete newbie with javascript and don't know how to call the image sources into an array or set up the abstraction to loop through the array.

any help would be greatly appreciated,
Adam

korkus2000

4:13 pm on Dec 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you able to atleast have the number of images in the folder on the page? Unfortunetly javascript cannot open the folder to see how many files exist. If you need to do that then you will need to use a server side language.

too much information

4:19 pm on Dec 24, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sure you can do it. But you will need to use ASP or PHP to list the directory and feed the number of images and image names into your Javascript variables.

I have a script online if you want to take a look at it. (Both ASP and PHP versions).

Sticky me if you want the address. Nevermind, I'll just sticky you the address and you can use it if you want. ;)

*added -

If you don't mind, can you sticky me the keywords you used in searching for your answer? I have had a few people hit my site looking for this same thing, but I'm sure there are more people looking for it.

aevea

5:55 pm on Dec 24, 2003 (gmt 0)

10+ Year Member



Thanks for the advice, I ended up doing it with php and posted my (more or less) final code in that forum(post 13):
[webmasterworld.com...]

tmi:
I started out searching for the keywords in the original and eventually went with "slideshow" even though that wasn't really what I wanted. I never really found what I needed, so I ended up re-inventing a few wheels. But I learned a lot in the process.

Adam