SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Dec 2013
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Some kind of looping help

    Hi there,

    What I need to accomplish is for every third <div> tag I need to apply a certain css class .solidcolor

    I think I can do something like

    Code:
    Do While Not objRS.EOF
    
    Record = Record + 1
    If Record Mod 3 = 0 Then
    Response.Write "<div class='tile'>
    Else
    Response.Write "<div class='tile solidcolor'>
    End If
    Response.Write "</div>"
    objRS.MoveNext() Loop Record = 0
    Not quite sure how to get it to work right.

    Please can someone advise?

    Thanks

  2. #2
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    looks like you're missing some end quotes on you div tags.

  3. #3
    SitePoint Member
    Join Date
    Jan 2014
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <code>Record = 0
    Do While Not objRS.EOF
    Record = Record + 1
    If Record<3 Then
    Response.Write ("<div class='tile'>"& something for your content)
    Else
    Response.Write ("<div class='tile solidcolor'>"& something for your content)
    Record = 0
    End If
    Response.Write "</div>"
    objRS.MoveNext()
    Loop
    </code>
    that line "If Record<3 Then" makes sure that it is each third div and not the fourth or second get specific CSS assignment.
    assuming that you already checked that recordset is not empty and you starting from first record.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •