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/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to