Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    May 2004
    Thanked 0 Times in 0 Posts

    Image gallery array help (code included)

    Hi there. I'm trying to build a simple image gallery where I can change multiple images based on selecting a top from a dropdown list (ie. selecting a submitting 'cars' from the dropdown list populates the images table with pictures of cars and so on). Plus I want to populate a 'href' for each picture. I've been looking around and haven't found anything quite suitable that doesn't rely on asp or refreshing the page. Any help would be much appreciated.

    I have this so far but it doesn't work...

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    var imageTags;
    var maxPics = 0;
    var carPics = new Array("red.gif");
    var vacationPics = new Array("green.gif"");

    function determineMaxPics()
    for(var i=0; i<pictureChanger.length; i++)
    var numPics = eval(pictureChanger.value).length;
    if(numPics > maxPics)
    maxPics = numPics;
    }//end for
    }//end determineMaxPics()

    function updatePictures(arrayName)
    var i=0;
    var picArray = eval(arrayName);
    for(; i<picArray.length; i++)
    imageTags.src = picArray;

    for(; i<maxPics; i++)
    imageTags.src = ""; //empties trailing picture tags
    }//end updatePictures(var)



    <a href="some generated value"><img name='image1' src=''></a><br />
    <a href="some generated value"><img name='image2' src=''></a><br />
    <select name='pictureChanger' onchange='updatePictures(this.value);'>
    <option value='carPics'>cars</option>
    <option value='vacationPics'>vacation</option>

    Last edited by max1973; 05-06-2004 at 04:20 PM.


Posting Permissions

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