Forums
This topic is locked
help with this
Posted 26 May 2005 08:28:14
1
has voted
26 May 2005 08:28:14 Jaime Romo posted:
hello there i have this questioni have a table with 30 fileds the id field and 29 image fileds
how can i make like a slide show with a button that moves to the next image if all the images are in the same recod???
i can make it work i have allready trayed repeat region and horizontal looper but it does not works?
any onw can tell me how can i do it please
thanks
Visit my home page
www.cancuncoral.com
Replies
Replied 14 Jul 2005 18:11:54
14 Jul 2005 18:11:54 myke black replied:
Easiest way is just to be a bit clever about your field names. If you call your fields something like this:
Img_id
img_1
img_2
img_3
etc.
then you make the link to the page pass in two parameters in the querystring like this:
viewImg.asp?row=2&image=6
then you can do a loop like this:
imgNum = cint(request("images")
rowNum = cint(request("row")
set rs = conn.execute("select * from imgTable where img_id=" & rowNum)
if not rs.eof then
thisImage = rs.fields("img_" & request("image")
end if
nextImage = imgNum [add] 1 ' substitute [add] for plus sign
prevImage = imgNum - 1
if imgNum = 1 then prevImage = 30
if imgNum = 30 then nextImage = 1
response.write "<input type=button value=next onclick=""window.location.href='viewImg.asp?row=2&image=" & nextImage & "'"">"
response.write "<input type=button value=prev onclick=""window.location.href='viewImg.asp?row=2&image=" & prevImage & "'"">"
Img_id
img_1
img_2
img_3
etc.
then you make the link to the page pass in two parameters in the querystring like this:
viewImg.asp?row=2&image=6
then you can do a loop like this:
imgNum = cint(request("images")
rowNum = cint(request("row")
set rs = conn.execute("select * from imgTable where img_id=" & rowNum)
if not rs.eof then
thisImage = rs.fields("img_" & request("image")
end if
nextImage = imgNum [add] 1 ' substitute [add] for plus sign
prevImage = imgNum - 1
if imgNum = 1 then prevImage = 30
if imgNum = 30 then nextImage = 1
response.write "<input type=button value=next onclick=""window.location.href='viewImg.asp?row=2&image=" & nextImage & "'"">"
response.write "<input type=button value=prev onclick=""window.location.href='viewImg.asp?row=2&image=" & prevImage & "'"">"