473,414 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

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.imageSource; //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
Jul 20 '05 #1
1 3087
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(anImage.src = args.imageSource;',5);
......

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

su**@acheson-crow.com (Charlie) wrote in message news:<57**************************@posting.google. com>...
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.imageSource; //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

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Barry Pearson | last post by:
I'm not asking a question. I'm simply showing a technique that may be useful to some people in future. I wanted a way of using photographs for rollover effects without having to slice the...
2
by: Mythran | last post by:
On all test machines, some images load, others don't (all in IE 5.5 and above). So, how can I force all images on an html/aspnet page to load? What I mean by they do not load, I have to...
2
by: Carl Gilbert | last post by:
Hi I am developing a site that has 5 or 6 thumbnail pages each with 28 image on each. Each thumb nail has a matching larger image. So 5/6 groups of 28. When the user clicks on one of the...
3
by: Solitus | last post by:
Lets say i have 2 images, a.jpg and b.jpg Both are actually one same picture of a bear but have different filenames. is there anyway in .net that i can find out if the two pictures are actually...
3
by: Alan | last post by:
Hi, I'm converting a database application from Access 97 to C#/SQL Server. Old database contains some images in OLE fields. I've figured out that there's OLE header preceeding actual image data...
3
by: pedrito | last post by:
I've got an app that downloads images off the internet using anywhere from 1-20 threads concurrently (though generally around 4 threads). I have a preview page that shows the images as they're...
2
elamberdor
by: elamberdor | last post by:
Hi All! Well, i'm modifying a dynamic map, with lat and long datapoints, my problem is it loads in text perfectly onto exact points I specify on the map, ..well now I want to load in...
7
by: Keith Hughitt | last post by:
Hi all, I am having trouble preloading images in a javascript application, and was wondering if anyone had any suggestions. Basically I have a bunch of images stored in a database as BLOBs. At...
5
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.