[Javascript] An image loader nearly working except for IE

Troy III Ajnej trojani2000 at hotmail.com
Mon Jul 18 14:39:40 CDT 2005


Hi there,
>One last thing what's the [0] i see in many scripts for ?
Nice,
lets first explain the '.images[0]' statement, -with it you point the 
particular image object in document collection.
If you like to target the first image in the collection than it has to be 
value '[0]' since in JS, counting starts at null.
If you like to check the state for the second image in the document than you 
can refer to it as ...images[1]... and so on.

Secondly;
the onReadyStateChange can fire only from within HTML but, sure one can 
emulate it, inserting the IMG object on the fly with a proper script that 
contains the onreadystatechange event handler.

Quote:[you can't make anything fullproof, because fools are so ingenious]

>Ok i missed something obvious in fact... Thank for this script... I'll see 
>if i can use it in another case, very interesting idea indeed...

Thanks, but please don't use it, at least not without notice about the 
author.

And the last more important, I've seen the J.Lester Novros IIth,  idea that 
is one of the best and completed solutions allready. You should check it at:
http://lester.demon.nl/test/imgLoaderTest.html
If still available.

But at the end, I still think that this (following) tinny little script can 
do almost all the magic:
*******************************************************
function isImageLoaded(){
         if( document.images[0].complete){
		mask.style.display='none'}//mask is the ID of the masking div
                         else {
	                mask.style.display='block'}
                                   }
onload=isImageLoaded
******************************************************
Please test it against the targeted browsers and report the failures
(works great on IE though)

My Best Regards

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/




More information about the Javascript mailing list