+ Reply to Thread
Results 1 to 4 of 4

Thread: java script and pictures

  1. #1
    Join Date
    Sep 2007
    Posts
    1

    Default java script and pictures

    I build websites for realtors and have javascript to display pictures on my website. Most listings have 8 pictures; when there are 8 pictures everything looks great. The problem is when there is a picure missing. The script shows the no picture image, what i want it to do is go to the next picture.

    Example:
    http://idxproperties.com/flpp/detail...=722668#thetop
    click the next key, if there is no picture I want it to go to the next picture, not show the no photo image.

    Thanks for any help.

    BTYRRELL

  2. #2
    Join Date
    Nov 2005
    Posts
    18

    Default Re: java script and pictures

    You must preload your images and check if an image source is actually valid before you run your script, see below example.

    var image1 = new image();
    image1.src="/images/someimage.gif";
    if (image1.src=="")
    {
    // do something to skip that image here
    }
    Colorado Real Estate and luxury resort properties.

  3. #3
    Join Date
    Feb 2007
    Location
    Fort Lauderdale, Florida
    Posts
    1,498

    Default Re: java script and pictures

    Maybe I'm wrong, but the link you sent I only counted 6 pictures in there, not 8, and it worked perfectly?
    If you're not remembered, you never existed.

  4. #4
    Join Date
    May 2007
    Location
    far east
    Posts
    690

    Default Re: java script and pictures

    I'm putting all images into a JS array, and loading full image when I click on thumbnails.

    <script type="text/javascript"> var imgAr = new Array(2);
    imgAr[1]='url_img1.jpg';
    imgAr[2]='url_img2.jpg';

    function show(index)
    {
    document.getElementById('mainp').src = imgAr[index];
    }
    </script>

+ Reply to Thread

Posting Permissions

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