<cfset firstcolor = "blue">
<cfset secondcolor = "red">
<cfset bgcolor = "#firstcolor#">

After each row insert the following:

<cfif bgcolor is "#firstcolor#"><cfset bgcolor = "#secondcolor#">
<cfelse><cfset bgcolor="#firstcolor#">

Include that in the <cfif> that you use to determine weather a given row is
to be display (after the HTML for that row) so that way if it is displayed
it will change the bgcolor variable for the next iteration, regardless of
what happened before or after it.

Jon
****************************************************
Jonathan R. Karlen
President
Karlen Internet Solutions, Inc.
Web Site and Application Development
http://www.karlen.com
[EMAIL PROTECTED]
(914)-923-2116

-----Original Message-----
From: Ryan [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 15, 2000 12:14 PM
To: CF-Talk
Subject: Alternating TR colors

Lets say I wanted the background color of each row in a table to be
different colors. I found this code:

COLOR=###IIF(QueryName.currentrecord MOD 2, DE ('E9E7CF'), DE ('FFA768'))#

But I'm not looping through a query, I'm just manaully writing table rows,
BUT, some of the rows may not always be displayed, so I can't just hardcode
the color values, because then you'd have two rows right after each other
that are the same color.

In perl I would just write a function that increments a counter and returns
the new result. Like:

COLOR=###IIF(MyIncrementFunc(counter) MOD 2, DE ('E9E7CF'), DE ('FFA768'))#

How can I accomplish this in ColdFusion?

Thanks,

Ryan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to