...

View Full Version : w to check that an array of images (backgrounds for divs) are actually loaded



_com
02-10-2006, 11:11 PM
how to check that an array of images (backgrounds for divs) are actually loaded and displayed. And when the DOM is ready to execute a DOM/JS script

shyam
02-11-2006, 02:51 PM
can't u create temporary Image objects with the same images and check if they have loaded and then start processing...sorta like this


var img = new Image();
img.onload = function() {
// when this is executed the image has definitely
// loaded and would have been applied to the bg
}
img.src = '...';

if u have multiple images that need to get loaded use a global count var and increment it for each load and do ur stuff once a certain count is reached

Kor
02-13-2006, 04:20 PM
I am not very sure about the correctness of the method. Upon W3C, onload is an event which might be applied only upon window, frame and iframe objects and must be unique on the same element.

http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.3

shyam
02-14-2006, 11:07 AM
I am not very sure about the correctness of the method. Upon W3C, onload is an event which might be applied only upon window, frame and iframe objects and must be unique on the same element.

http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.3
entirely true



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum