...

View Full Version : Choosing a specific picture from an array



Kazbaeden
08-05-2002, 07:58 PM
I'm trying to make a picture gallery. Here's how I'm trying to make it:
On the main page is a number of thumbnails.
If you click on one it will open a new window and display the full image.
In that window will be a forward and backward button that moves through the other images.
I've got all that down, but my question is, how would I choose a picture from the array to display first?
Say I have two pictures in the thumbnail index. I Click on the first one and a popup window comes up and it displays the first image in the array. How would I make it so when I click on the second image the pop up window will display the second image in the array?

http://mywebpages.comcast.net/kazbaeden/NEW/Page002.htm

This is a little mockup I've done. I use the onClick="window.open();" command to open the popup, which is targeted to Page001.htm. Page001.htm is the page that has the array in it. Thanks for any help. =)

beetle
08-05-2002, 10:01 PM
looks just fine to me. Did you fix it?

Kazbaeden
08-06-2002, 02:14 AM
The slide show works fine, yes. I just don't know how to open the slide show to a specific picture. Does this make sense, what I'm trying to explain? Please let me know. Thanks

beetle
08-06-2002, 05:02 AM
use the query string to pass a param, and extract that data for your first() function.
window.open('page1.htm?3','','features');

then, in the popup....

var firstSlide = parseInt(top.location.search.substring(1));
etc. etc.

See if you can get it from here...

Kazbaeden
08-10-2002, 04:56 AM
Sorry... I can't quite get it to work... do you think you could explain a little more? Thanks

beetle
08-10-2002, 05:49 AM
Use an onLoad triggered function that initializes the picture instead of hardcoing picture1 into the HTML. this function would use the variable I set in my last post.

Kazbaeden
08-10-2002, 05:23 PM
I think I'm getting it...
I really don't know much of this code since most of it isn't mine, but this is what I did...

onLoad="javascript:var firstSlide = parseInt(top.location.search.substring(1));"

I put that in the body tag replacing onLoad="javascript:first();"

and in the image tag I replaced id="thepic" and src="thepic" with id="firstslide" and src="firstslide"

I know I'm doing something wrong because I'm totally unskilled with Javascript. =P

beetle
08-12-2002, 06:12 AM
Apologies. I was operating under the assumption that you coded the slideshow. Change up first() to look like this:
function first()
{
curindex = firstSlide;
showcurrent();
} And just make sure the firstSlide var gets declared at the top with the other globals.

Barnabee
08-16-2002, 03:27 AM
I'm having a little trouble with this myself...

I get the error firstslide is undefined, I'm curious if I defined it at the wrong spot. I put it where all the other variables were being defined, in function showcurrent.

Here is the page:

http://www.baelfire.net/temp/Page001.htm

You guys know better than me. I appreciate your help.

beetle
08-16-2002, 06:21 AM
ya, firstSlide has to be global, and declared before any functions use it. Put it here

var curindex=0;
var gap=4;
var firstSlide = parseInt(top.location.search.substring(1)); And make sure not to re-declare it in the showcurrent() function.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum