In response to Which Rows are Odd and Even?, three readers have come up with alternate solutions to Bruce Strickland's green-bar paper report look-a-like project:
The way I decide which row is even or not is very simple. This method is dated way back when
computing power was a wee bit small. This method only uses subtraction,
which is a very easy computation.
' Initialize.
IsThisAOddRow = 2
<loop>
IsThisAOddRow = 3 - IsThisAOddRow
if IsThisAOddRow = 1 then
<Odd row>
else
<Even row>
end if
<end loop>
The variable "IsThisAOddRow" will change between 1 and 2, therefore is it
very easy to decide which kind of row you are working with.
Submitted by Jesper Partoft
####################
If countTr Mod 2 <> 0 Then
Response.Write "<TR BGCOLOR=#FFAAAA>"
Else
Response.Write "<TR BGCOLOR=#FFFFFF>"
End If
Submitted by Pete Ramos
####################
counter = 0
Do while not oRs.eof
counter = counter + 1
if counter MOD 2 = 1 then
bgcolor = "#F5F5F5"
else
bgcolor = "White"
end if
response.write "<tr bgcolor=" & bgcolor & "><td>Information goes
here</td></tr>"
oRs.movenext
loop
Submitted by Jonathan Kretzmer