I want to alternate the color of rows in a table that I am building that will output query results, how do I do this
row #
1 [red]
2 [white]
3 [red]
4 [white]
5 [red]
6 [white]
7 [red]
8 [white]
Inside your output loop, just keep track of a variable and set the row color depending on whether it's 1 or 0 like this.
<cfset rowColor = 0>
<cfoutput query="q1">
...... Html here ........
<tr bgcolor="##<cfif rowColor is 0>ffffff<cfelse>000000</cfif>> ..... </tr>
......... More html ........
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.