Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2007
    Posts
    34
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Problem with looping

    Hi guys, i have a problem of looping these script into 4 columns, this is my script, pleasse help...

    Dim oFilesys, oFolder, oFile
    Set oFilesys= CreateObject("Scripting.FileSystemObject")
    Set oFolder= oFilesys.GetFolder(Server.MapPath("/images/lettings/" & letID & "/"))

    Response.Write "<img src='http://www.edwardsandtowers.com/images/lettings/"& RS("Lettcode") & "/pic1.jpg' style='width:365px; height:270px;' id='main'>"

    For Each oFile in oFolder.Files

    Response.write "<a href='#' onclick=main.src='"& RS("Lettcode") & "/" & oFile.Name &"';><img src='"& RS("Lettcode") &"/" & oFile.Name &"' style='width:85px; height:60px;' border='0'></a>"
    Response.write "<br />"

    Next

    Set oFolder=Nothing
    Set oFilesys=Nothing

    rs.close
    cn.close
    Set rs = Nothing
    Set cn = Nothing
    remanythm

  • #2
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    On your IMG tags, use WIDTH and HEIGHT, not STYLE. Although STYLE works, in HTML those are not the correct tags for IMG.

    Try:

    Code:
    Response.write("<a href=""#"" onclick=""main.src='" & RS("Lettcode") & "/" & oFile.Name & "';""><img src=""" & RS("Lettcode") & "/" & oFile.Name & """ width=""85"" height=""60"" border=""0""></a>")
    If you want columns, why the <br /> tag between your <a></a> tags? That will automatically create rows, not columns.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.


  •  

    Posting Permissions

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