Alternating row colors (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


KCIWebMaster -> Alternating row colors (3/29/2001 20:13:00)

I saw the tutorial about how to alternate row colors but since I am not using the DRW I am a little confused as to where to put the tags. Here is my code, which displays all the records in the database (only 3 of the fields):

<table border="1" width="944">
<tr>
<td width="166" bgcolor="#000000"><font color="#FFFFFF" face="Verdana"><strong>Date first
reported</strong></font></td>
<td width="365" bgcolor="#000000"><font color="#FFFFFF" face="Verdana"><strong>Description</strong></font></td>
<td width="165" bgcolor="#000000"><font color="#FFFFFF" face="Verdana"><strong>Status</strong></font></td>
</tr>
<%
On Error Resume Next
ph.MoveFirst
do while Not ph.eof
%>
<tr>
<td width="166"><small><%=ph("reportdate")%></small> </td>
<td width="365"><font face="Verdana"><small><a
href="detail_history.asp?description=<%=ph("PHID")%>"><%=ph("Description")%></a></small></font></td>
<td width="165"><small><%=ph("status")%></small> </td>
</tr>
<%
ph.MoveNext
Loop
%>
</table>

Thanks!





Spooky -> RE: Alternating row colors (3/29/2001 20:13:00)

Like so!

.......
<tr>
<td width="166" <%
if x = 1 then
bgcolor="gray"
response.write "bgcolor='gray'"
x=2
Else
bgcolor="White"
Response.write "bgcolor='white'"
x=1
End if %>><small.....

------------------
Spooky
"I am Spooky of Borg. Prepare to be assimilated, babycakes!"
Subscribe to OutFront News
Database / DRW Q & A
The Spooky Login!





KCIWebMaster -> RE: Alternating row colors (3/30/2001 20:28:00)

Hi Spooky,

I inserted the code in my table and I get an error:

Microsoft VBScript compilation error '800a03fb'

Expected 'Loop'

/Databases/PartsHistory/Show_All.asp, line 60

Else
^

What did I do wrong?

Also, it seems to be like this will only alternate cell colors, how does it know to do the whole row if I have 3 cells per row?

Thanks for your help





Spooky -> RE: Alternating row colors (3/30/2001 21:11:00)

Heres the row version. Are you missing a tag somewhere?


.......
<tr <%
if x = 1 then
response.write "bgcolor='gray'"
x=2
Else
Response.write "bgcolor='white'"
x=1
End if %>>
<td width="166"><small.....





KCIWebMaster -> RE: Alternating row colors (4/2/2001 20:11:00)

Hi Spooky,

Thanks so much for your help. It's working great now. I must have had a misplaced or missing tag somewhere.





Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875