Forum Moderators: open

Message Too Old, No Replies

Image Preload

check to see if image preloading works

         

luckydude

4:42 am on Dec 21, 2004 (gmt 0)

10+ Year Member



I found this script somewhere and was wondering how to check to see if all the Images have been preloaded or not. Is there anyway we can check it? Thanks.

Here is the code:


<script language="JavaScript1.1">
function simplePreload()
{
var args = simplePreload.arguments;
document.imageArray = new Array(args.length);
for(var i=0; i<args.length; i++)
{
document.imageArray[i] = new Image;
document.imageArray[i].src = args[i];
}
}

simplePreload( 'img1.jpg', 'images/img2.gif' );

</script>

orion_rus

8:48 am on Dec 21, 2004 (gmt 0)

10+ Year Member



If in your function exists such string
document.imageArray[i] = new Image;
document.imageArray[i].src = args[i];
this images would be preload automatically, which images are not defined so) it is not preloaded))
u can use such syntax to preload images too:
<img src="new.jpg" style="display:none">
good luck to you