images not showing even after pre load

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Charlie

    images not showing even after pre load

    Hi
    I am using the following code to create an image viewer for multiple
    images.

    var pageImage = document.images['mainImage'];
    var image = new Image();
    var args = GetQuerystring( ); //return arguments from querystring
    image.src = args.imageSourc e; //get image src
    pageImage.src = "";
    pageImage.src = image.src;


    IE one image after another using one page as the viewer. The view
    loads the image into an Image object and then displays it on the page
    after doing some resizing etc

    However I am getting erroneous results from time to time. Most of the
    images will load in the viewer, then I will get one that doesn't load,
    it doesn't even show a placeholder, it will load if refresh is hit or
    if the viewer is moved on to another image and then moved back.

    I have also tried setting the src of the image to "" and then setting
    the src to the new image with no luck. I could of course load all the
    images into the cache, but with potentially hundreds of images, this
    is impractical.

    Any help would be very gratefully received

    Cheers

    Charlie
  • Frank

    #2
    Re: images not showing even after pre load

    First of all I would never use 'image' as variable name, rather
    'anImage' although it seems that it is not a reserved word.
    I have had luck with using the setTimeout method when changing image
    source. Try this:
    var anImage = new Image();
    ......
    setTimeout(anIm age.src = args.imageSourc e;',5);
    ......

    If that does not work, make sure your GetQueryString method works ok,
    put an alert after it, so:
    ......
    var args = GetQuerystring( );
    alert(args);
    ......

    subs@acheson-crow.com (Charlie) wrote in message news:<57065011. 0310051450.13bf 34c5@posting.go ogle.com>...[color=blue]
    > Hi
    > I am using the following code to create an image viewer for multiple
    > images.
    >
    > var pageImage = document.images['mainImage'];
    > var image = new Image();
    > var args = GetQuerystring( ); //return arguments from querystring
    > image.src = args.imageSourc e; //get image src
    > pageImage.src = "";
    > pageImage.src = image.src;
    >
    >
    > IE one image after another using one page as the viewer. The view
    > loads the image into an Image object and then displays it on the page
    > after doing some resizing etc
    >
    > However I am getting erroneous results from time to time. Most of the
    > images will load in the viewer, then I will get one that doesn't load,
    > it doesn't even show a placeholder, it will load if refresh is hit or
    > if the viewer is moved on to another image and then moved back.
    >
    > I have also tried setting the src of the image to "" and then setting
    > the src to the new image with no luck. I could of course load all the
    > images into the cache, but with potentially hundreds of images, this
    > is impractical.
    >
    > Any help would be very gratefully received
    >
    > Cheers
    >
    > Charlie[/color]

    Comment

    Working...