Alternating table background colors

Discussion in 'ASP General' started by Newton, Jun 12, 2004.

  1. Newton

    Newton Guest

    I know how to alternate table row bgcolor by odd/even method but what I am
    trying to acheive is alternate colors by the date value in the database so
    that each row with the same date value has the same bgcolor. There maybe 3
    red rows for 1st date, then 2 blue rows for 2nd date, then 6 red rows for
    next date etc.
    I have no idea where to start, any suggestions?
    Newton, Jun 12, 2004
    #1
    1. Advertising

  2. Dim curdate
    Dim prevdate
    Dim bgcolor
    If Not rs.eof
    curdate = rs("datecolumn")
    prevdate = curdate
    while not rs.eof
    curdate = rs("datecolumn")
    If curdate <> prevdate Then
    If bgcolor = "blue" Then
    bgcolor = "red"
    else
    bgcolor = "blue"
    end if
    prevdate = curdate
    End If

    'Process record
    Wend

    Untested, Ofcourse ;)


    --
    Roji. P. Thomas
    SQL Server Programmer

    "Newton" <> wrote in message
    news:Xwxyc.2203$...
    > I know how to alternate table row bgcolor by odd/even method but what I am
    > trying to acheive is alternate colors by the date value in the database so
    > that each row with the same date value has the same bgcolor. There maybe 3
    > red rows for 1st date, then 2 blue rows for 2nd date, then 6 red rows for
    > next date etc.
    > I have no idea where to start, any suggestions?
    >
    >
    Roji. P. Thomas, Jun 12, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ralph Snart
    Replies:
    2
    Views:
    772
    Ralph Snart
    Aug 3, 2003
  2. Guest
    Replies:
    5
    Views:
    1,705
    Eliyahu Goldin
    Jul 13, 2006
  3. colo
    Replies:
    2
    Views:
    323
  4. fig000
    Replies:
    0
    Views:
    4,544
    fig000
    Sep 6, 2004
  5. Alistair Birch

    Alternating Table Background Colour

    Alistair Birch, Oct 27, 2003, in forum: Javascript
    Replies:
    1
    Views:
    157
Loading...

Share This Page