Or taking the same technique one step farther, use the mod value directly in
the class names:
<STYLE>
.row0 { background-color: silver; }
.row1 { background-color: gray; }
</STYLE>
<CFOUTPUT>
<TABLE>
<CFLOOP QUERY="foo">
<TR CLASS="row#(CurrentRow MOD 2)#"><TD>#CurrentRow#</TD></TR>
</CFLOOP>
</TABLE>
</CFOUTPUT>
-----Original Message-----
From: Rick Osborne [Mojo] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 21, 2001 3:03 PM
To: CF-Talk
Subject: RE: Alternating BG colors on a <TD>
Chad Gray asked:
> When using a <CFOUTPUT QUERY=""> tag on a table how do i get every other
> <TD> to have a background color?
My favorite way:
<STYLE>
.evenrow { background-color: silver; }
.oddrow { background-color: gray; }
</STYLE>
<CFSET EvenOdd=ListToArray("oddrow,evenrow")>
<CFOUTPUT>
<TABLE>
<CFLOOP QUERY="foo">
<TR CLASS="#EvenOdd[IncrementValue(CurrentRow MOD
2)]#"><TD>#CurrentRow#</TD></TR>
</CFLOOP>
</TABLE>
</CFOUTPUT>
This allows me to define any styles I want in the STYLE part, including
background color, fonts, etc. But then, I'm a CSS nut ... Plus I like
using the MOD function and arrays. Takes me back to my C days when
programming was so much more fun. ;)
-R
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Alternating BG colors on a
Jann VanOver
Tue, 21 Aug 2001 14:52:06 -0700
- Re: Alternating BG colors on a <TD> Clint Tredway
- Re: Alternating BG colors on a <TD> Don Vawter
- RE: Alternating BG colors on a <TD> Carlisle, Eric
- RE: Alternating BG colors on a <TD> Nate Smith
- RE: Alternating BG colors on a <TD> Dan G. Switzer, II
- RE: Alternating BG colors on a <TD> Kevin Mansel
- RE: Alternating BG colors on a <TD> Sicular, Alexander
- RE: Alternating BG colors on a <TD> Carlisle, Eric
- RE: Alternating BG colors on a <TD> Raymond Camden
- RE: Alternating BG colors on a <TD> Nate Smith
- Jann VanOver
Reply via email to
Jann VanOver Tue, 21 Aug 2001 14:52:06 -0700
- Re: Alternating BG colors on a <TD> Clint Tredway
- Re: Alternating BG colors on a <TD> Don Vawter
- RE: Alternating BG colors on a <TD> Carlisle, Eric
- RE: Alternating BG colors on a <TD> Nate Smith
- RE: Alternating BG colors on a <TD> Dan G. Switzer, II
- RE: Alternating BG colors on a <TD> Kevin Mansel
- RE: Alternating BG colors on a <TD> Sicular, Alexander
- RE: Alternating BG colors on a <TD> Carlisle, Eric
- RE: Alternating BG colors on a <TD> Raymond Camden
- RE: Alternating BG colors on a <TD> Nate Smith
- Jann VanOver

