Search Tools Links Login

Simple row coloring


The fastest way to do alternate colors of rows in your table (from recordset or something)

Original Author: Rammi

Code

<html>
<head>
<title>Alternate rows
color</title>
</head>
color=#000066><style>
.lnTrue {
 background :
Gray;
 }


.lnFalse {
 background :
Silver;
 }
</style>
<body>
<table>
 <tr>
 <th>Test</th>
 </tr>
<%
Dim
objRs, blnLine


Set objRs = Server.CreateObject("ADODB.RecordSet")
objRs.Open "SOME QUERY
HERE", "Connection string"


blnLine =
False


Do Until objRs.EOF
 Response.Write color=#000066>"<tr class=""ln" & blnLine & """>"
& _
   "<td>" & objRs(0) &
"</td></tr>"
 blnLine =
Not(blnLine) 

 objRs.MoveNext
Loop
Set objRs
= Nothing
%>
</table>
</body>
</html>


--------------------------------------------
Blue bold parts are the most
important...


About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 100 times

Categories

ASP/ HTML

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.