Click to See Complete Forum and Search --> : load bg first


Itai Raz
04-03-2000, 03:29 PM
Anybody knows of a way to load the background image first, and only then
load other images?

Thanks,

Itai

Dev Ashish
04-04-2000, 08:43 AM
You could try pre-loading the image. Start off by assigning a transparent
image to background, and then change it dynamically.

FWIW, I haven't been able to get this to work on NS, so wouldn't suggest
putting this in production. Also, preloading will make your page render
slowly, so use it wisely (IOW, avoid 'em if you can).

One thing you can try in NS is to define a layer, size it to client area and
change it's Background with

document.YourLayerName.background.src = arrImages[1];

<HTML>
<SCRIPT Language="Javascript">
<!--//
function fLoadImages() {
var arrImages = new Array(1);
arrImages[1] = new Image;
arrImages[1].src = "images/hpbackground1.jpg";
file://for IE, use this line
document.body.background = arrImages[1].src;
}
file://-->
</SCRIPT>
<BODY onload="fLoadImages()" background="images/spacer.gif">
<p>this text shouldn't display until the image has finished loading</p>
</BODY>
</HTML>

-- Dev

Itai Raz wrote in message <38e8dfdd$1@news.devx.com>...
:Anybody knows of a way to load the background image first, and only then
:load other images?
:
:Thanks,
:
:Itai
:
:

Itai Raz
04-04-2000, 07:18 PM
Do you still believe the legend about images that you put into variables are
loaded before the page does?

Itai