PDA

View Full Version : refresh page = new image


jondj24
09-15-2003, 12:04 PM
hello, i cannot seem to find a script that can make the background image of my project change everytime the user hits the refresh button. can you please point me in the right direction please?!!??

thanks.
jonathan

webguy
09-15-2003, 12:50 PM
hello jondj24 and welcome to the forums!

You can simply put references to them into an array and pull a random one each time!


imgArray = ["image1","image2","image3"];


then use this code to pull a random image reference from the array


randImg = Math.floor(Math.random()*imgArray.length);


Then load the image after the randImg has been defined


loadMovie(randImg, depth);


I hope that helps you get on the right track. For more information do a search for random here on this forum and you will find a hundred and one threads pertaining to methods that are similar to what you are trying to achieve.

web