Randomize which image is loaded into my html page. How?

Pretty much what the title suggests. I am building a basic html page for my website, and there are several people involved in the music. I want to stick an image in the upper left hand corner, and I thought a fun idea would be to randomize what image it sticks in when the page loads. I figure it would make the page a little more interesting, and it was also a good way to not bruise any egos. I imagine some sort of javascripting is involved, which isn’t too bad, I’ve dabbled around with it before. However, like most things, the less mumbo jumbo involved, the better.

Thanks in advance.

A google search for “free java random image” comes up with lots of good sources. Here’s one link:java-scripts.net.

PS Fastest reply to a Question?

Nah, I’ve gotten 'em in under a minute. :wink:

Sweet, thanks guys.

Hey I’m finally getting around to doing this 10 months later! :stuck_out_tongue:

What happens if javascript isn’t enabled? What will the person viewing my page see? A white box with the broken image link in it?

Is it worth trying to do this, or am I causing more problems?

Well, you could use PHP and take care of it all server side…I serve up nearly 400MB of images using PHP.

I found some php code on a site, but honestly, I wasn’t sure what to do with it.

Right I’m questioning the wisdom of randomizing between three 25k images.

      • Do it with Javascript, do it right in the web page. You can do it right away, yourself. What browsers don’t support Javascript now? As for PHP–it certainly can work except that most ISP’s that only offer simple web-space do not allow any server-side scripting at all, they just let you use disk space.
  • The only reason that the PHP would be necessary is if you wanted to hide the images from alternate means of viewing them. By hot-linking, or by people just entering the image’s address into their web browsers, for example.
    ~

Include a no-script set of tags that just display a static image.
Then if the user has javascript disabled they will still see a pic, but it won’t be randomised.

no-script tags are used by the browser when javascript is disabled.
So you kind of get the best of both worlds.