flamingsquirrel

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>

3 Responses to “Rotate elements on your page using cfswitch”

  1. AliasPoorYorik commented on

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

  2. andy commented on

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

  3. Daz commented on

    Cool thanks, its now on another CeB project!

Leave a Reply