Click to See Complete Forum and Search --> : slideshow popup
sevenz
02-26-2004, 06:13 PM
Hi,
Thanx in advance for any help you may be able to provide. I am using a slideshow script that displays various images. This script allows you to click on the image and displays the blown up version. What I would like to do with it however, is to have the blown up version appear in a new window. I have been able to do this by creating a window popup script. However, i need to create a different page for each image, which can eventually be in excess of 20 pages. Rather I would like to create one page that will using asp, automatically display the image that was clicked on the previous page. It's at thos point in which I am lost. Any suggestions?
Thanx Again
buntine
02-27-2004, 11:52 AM
Hey sevenz,
Its quite easy to achieve.
The most basic way is to set up an array of image filenames and then send a queryString variable to the page. Take a look at the example below.
Dim arrImages(4)
Dim intImage
arrImages(0) = "pic_one.jpg"
arrImages(1) = "pic_two.jpg"
arrImages(2) = "pic_three.jpg"
arrImages(3) = "pic_four.jpg"
intImage = request.queryString("picID")
if IsEmpty(intImage) or CInt(intImage) <= 0 then
intImage = 1
elseif CInt(picID) > UBound(arrImages) then
intImage = CInt(UBound(arrImages))
end if
with response
.write ("<img src=""" & arrImages(intImage) & """ name=""img"" height=""200"" width=""300"" />")
.write ("<br /><br />")
.write ("<a href=""" & Split(request.serverVariables("SCRIPT_NAME"), "?")(0) & "?picID=" & CInt(intImage) - 1 & "">Previous Pic</a>")
.write (" | ")
.write ("<a href=""" & Split(request.serverVariables("SCRIPT_NAME"), "?")(0) & "?picID=" & CInt(intImage) + 1 & "">Next Pic</a>")
end with
Copy this code into a new ASP file and name it whatever you like. Make sure you change the array members to correspond with your actual filenames.
The script should work 'as is', though, i havent tested it so if you run into trouble just post and i will help you out.
Regards,
Andrew Buntine.
sevenz
03-12-2004, 11:31 AM
Hi Buntine,
Thank you for the help. A couple more quesitons.
1. Does this script go on the page where the image is being clicked, or the page where the image is being displayed?
2. Do I need to use a <body onload=script_name()> tag?
Thanx
Darrin
buntine
03-12-2004, 09:52 PM
1. This script goes in the page where the image is being displayed. This should be the only code you need, other than the basic HTML template and a doctype. The script will actually display the pic on the screen.
2. No, onload is an event which is used to invoke a jsvsScript statament or function. You shouldnt use a JS event in conjunction with ASP.
Regards.
buntine
03-12-2004, 09:54 PM
Read the sticky 'ASP and JavaScript' at the top of the forum if you have trouble understanding the difference between JavaScript and ASP.