# Preloading an HTML Page



## bpetruzzo (Aug 10, 2004)

I'm cought with a delema. I need to preload an HTML page before any of it displays. Preferably, I'd like to take users to a splash screen, that completely loads the images and text on the following page. But here's where it gets tricky- the website contains some flash elements as well, which have thier own preloaders. So I don't want the flash elements to be preloaded, only images and text; so that when the users arive at the page, all the images appear in sync and the flash preloaders get to do their job.

Does anyone know of a way to do this?


----------



## Benstar (Sep 22, 2005)

This script may help you. Its a java script to pre load images. I pulled it from Dreamweaver as a behaviour:

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a_.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
}
//-->
</script>

This code calls the image as a preloaded image:

<body>
<img src="/yourimagespace/yourimage.jpg" width="750" height="89" onload="MM_preloadImages('/yourimagespace/yourimage.jpg')">
</body>
</html>

If your using Dreamweaver you can select the image, goto behaviours, go down the menu to "pre-load images". Then find an image on your site using the file browser that pops up and your done. I think you might have to do that for each image as well but I'm unsure.

Good Luck

Ben_


----------

