Rotate elements on your page using cfswitch

I have been using cfswitch to rotate banner images and quotes.

<cfswitch expression="#RandRange(1, 4)#">
 <cfcase value="1">Option A</cfcase>
 <cfcase value="2">Option B</cfcase>
 <cfcase value="3">Option C</cfcase>
 <cfdefaultcase>Option D</cfdefaultcase>
</cfswitch>

This entry was posted in coldfusion. Bookmark the permalink.

3 Responses to Rotate elements on your page using cfswitch

  1. If you wanted a random image you could just do:
    <img src=”mypath/myrandompic_#RandRange(1,4)#.jpg” />

  2. andy says:

    Cool, thanks. Will try and implement that on my next project.

  3. Daz says:

    Cool thanks, its now on another CeB project!

Leave a Reply

Your email address will not be published. Required fields are marked *

*


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>