Forum Moderators: open

Message Too Old, No Replies

Random Image on Refresh

any easy code?

         

PatrickKerby

3:51 am on Mar 15, 2004 (gmt 0)

10+ Year Member



Hey, I'm not much of a programmer, more so strictly a designer, but I'm looking for some simple code that would allow an image within a cell to load randomly from a designated subfolder of images when the page is loaded or refreshed.

Any quick simple code for this?
help would be greatly appreciated.
Thanks!

Rambo Tribble

3:56 am on Mar 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's simple if you enter the file names into the script, but JavaScript can't read a directory (a security feature). If you want that you'll need PHP, Perl, or the like.

PatrickKerby

4:11 am on Mar 15, 2004 (gmt 0)

10+ Year Member



ahh.. so if i keep all the files in the root folder, there will be no need for a database?

also... I dont know how to actually code this out, any suggestions for a resource where I could find some pre-written code?

martinibuster

4:14 am on Mar 15, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Easy. Search for Yaromat RANDOM SWAP IMAGE.

It's a Dreamweaver extension, but the code is all javascript. I use it on a couple sites.

You can also find something over at hotscripts.com if you search for "random images" and limit your search to JavaScript.

;) Y

Let us know how it turns out.

PatrickKerby

4:38 am on Mar 15, 2004 (gmt 0)

10+ Year Member



Works great.

thanks alot

cheers