Click to See Complete Forum and Search --> : Table row colors


Jack
03-04-2003, 11:27 AM
I want to alternate the returned rows in a table when a query has been processed. i.e first row light grey, then second row dark grey, then third row light grey again etc etc etc. Any ideas on how this is done would be gratefully appreciated.
Thanks
Jack

Ribeyed
03-04-2003, 02:09 PM
hi this is simple to do and can be done a few ways, here is my simple version:

<%
bgcolor = "red"
while not recordset.eof
%>
<table>
<tr bgcolor="<%if bgcolor = "red" then
response.write "#FF0000"
bgcolor = "blue"
else
response.write "#CCCCCC"
bgcolor = "red"
end if %>">
<td>
Some text here
</td>
</tr>
</table>
<%
recordset.movenext
wend
%>

Jack
03-05-2003, 04:53 AM
Many thanks, I will give it a go.