Well first off, you're not an idiot.  But the code you created sucks.  Is that fair?

Anyway,

All you really need to do is name your images 1-7, create a random number between 1-7 
and call an image file.

Here's how with 4 lines of code:

<cfset imagenum = RandRange(1,7)>

<cfoutput>
<img src="#imagenum#">
</cfoutput>

Simple.



--------------------------------------------------------------
Mark Warrick
Phone: (714) 547-5386
Efax.com Fax: (801) 730-7289
Personal Email: [EMAIL PROTECTED]
Personal URL: http://www.warrick.net 
Business Email: [EMAIL PROTECTED]
Business URL: http://www.fusioneers.com
ICQ: 346566
--------------------------------------------------------------


> -----Original Message-----
> From: Les Mizzell [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 19, 2000 6:29 AM
> To: [EMAIL PROTECTED]
> Subject: [CF-Talk] Random Images
> 
> 
> I'm using the block of code below to place a random image on a page each
> time the page is loaded.  However, for some reason, it only seems to swap
> the first THREE images out, not all seven.
> 
> 
> <cfparam name="imageswap" default="#randrange(1,7)#">
> <cfif #imageswap# is "1">
>       <img src="home_photo1.jpg">
> <cfelseif #imageswap# is "2">
>       <img src="home_photo2.jpg">
> <cfelseif #imageswap# is "3">
>       <img src="home_photo3.jpg">
> <cfelseif #imageswap# is "4">
>       <img src="home_photo4.jpg">
> <cfelseif #imageswap# is "5">
>       <img src="home_photo5.jpg">
> <cfelseif #imageswap# is "6">
>       <img src="home_photo6.jpg">
> <cfelseif #imageswap# is "7">
>       <img src="home_photo7.jpg">
> </cfif>
> 
> I could do this with JavaScript instead, but hell, it's close to 50 total
> lines of code by the time you're done. Is there any way to get it a little
> more "random" and show all seven images instead of just the first 
> three like
> it's doing?
> 
> Or....am I a total idiot and have a simple syntax error I'm just 
> not seeing
> here?
> 
> 
> 
> Les Mizzell
> ***********
> Some people say I'm too apathetic.
> But why should I care?
> 
> ------------------------------------------------------------------
> ------------
> Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> To Unsubscribe visit 
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf
_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the 
body.

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebarRsts&bodyRsts/cf_talk or send a message 
to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to