#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    6
    Rep Power
    0

    alternate records


    I am really new at this. I have basic results working. What I want to do is alternate every other record with a new CSS Style so it's easier to read. Not sure how to do this so anything would be helpful. I want to use the class ' statsDataRow1 ' and ' statsDataRow2 ' as my alternating styles.

    Thanks
    Rob
    ----------------------------------------------------------------------------------

    <table border="1" width="85%">
    <%do until rs.EOF%>
    <tr>
    <td class="statsDataRow1"><%Response.Write(rs("Nickname"))%>
    <td class="statsDataRow1"><%Response.Write(rs("FirstName"))%>
    <td class="statsDataRow1"><%Response.Write(rs("LastName"))%>
    <td class="statsDataRow1"><%Response.Write(rs("E-mail"))%>
    <td class="statsDataRow1"><%Response.Write(rs("AOL"))%>
    <td class="statsDataRow1"><%Response.Write(rs("Birthday"))%>

    <%rs.MoveNext%>
    </tr>
    <%loop

    rs.Close
    conn.Close
    %>

    </table>
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,280
    Rep Power
    4279
    i think your question would be better suited in the ASP or VB forum (or whatever language that is) than the SQL Server forum

    but anyhow, if your scripting language does not already provide a built-in record number for query results, declare a variable yourself and add 1 to it every time you go to print a record

    when you print a record, divide the record number by 2 and examine the remainder -- it will be 0 or 1, and that will tell you which class to apply

    look for a MOD or MODULO or MODULUS function to get you the remainder automatically

    also, your html will be cleaner if you apply the class to the TR instead of each individual TD
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    6
    Rep Power
    0
    Thank you. I realized after I posted it was in the wrong spot.

    Thanks again

IMN logo majestic logo threadwatch logo seochat tools logo