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

load images

Status
Not open for further replies.

WannaLearn

Programmer
Jul 10, 2001
210
0
0
US
I was wondering if it's possible to load a different image upon reload? What I want to do is, I have 5 images which I want to change upon refresh. How can I do that? I was thinking of using the randrange() function. But i'm sort of clueless on how to implement that. Any help is much needed. Thanks.
 
if you only have 5, you can put them in a list and pick one randomly:
Code:
<cfset imgList="image1.gif,image2.gif,image3.gif,image4.gif,image5.gif">
<cfoutput>#ListGetAt(imgList,RandRange(1,ListLen(imgList)))#</cfoutput>
 
Thanks for responding so fast. Will this change the image on refresh?
 
it does change, but since there are only 5 images, there are instances when the random function picks the same image 2 times in a row.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top