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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random image generation

Status
Not open for further replies.

SjrH

IS-IT--Management
Jun 24, 2003
747
GB
I've seen some answers to this question before but i'm not sure that they'll achieve what i'm trying to do.

Basically, I have a small area in which is a 3 x 3 table. Each of the nine square areas will contain a small GIF image chosen from a couple of hundred at random.
My first question is how can I ensure that once an image has been loaded at random, it doesn't get loaded again on the same page load?

Secondly, each image should have a link that will popup a page relating to the image clicked on. At the same time, i'd like to include some title/alt text to be shown when the mouse is hovered over the image.

Can I achieve all this with javascript?

Thanks!
 
Question 1)
Record the names of the images you have already chosen. When you choose a new image, check the array of chosen images. If the image has already been chosen, pick another (and repeat)... if not, add it to the array of chosen ones and then output the image.

Question 2)
You can do all this in javascript triggered on the window.onload event.

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top