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 10 of 10
  1. #1
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Choosing a specific picture from an array

    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. =)

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    looks just fine to me. Did you fix it?

  • #3
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    use the query string to pass a param, and extract that data for your first() function.
    Code:
    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...

  • #5
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry... I can't quite get it to work... do you think you could explain a little more? Thanks

  • #6
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #7
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy

    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

  • #8
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Apologies. I was operating under the assumption that you coded the slideshow. Change up first() to look like this:
    Code:
    function first()
    	{
    	curindex = firstSlide;
    	showcurrent();
    	}
    And just make sure the firstSlide var gets declared at the top with the other globals.

  • #9
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #10
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ya, firstSlide has to be global, and declared before any functions use it. Put it here
    Code:
    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.


  •  

    Posting Permissions

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