...

View Full Version : Problem with looping



jerusking
06-08-2007, 04:27 PM
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

Daemonspyre
06-08-2007, 09:18 PM
On your IMG tags, use WIDTH and HEIGHT, not STYLE. Although STYLE works, in HTML those are not the correct tags for IMG.

Try:



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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum