onLoad for background image

C

Csaba2000

With image elements I can do <IMG src="..." onLoad="..."> where
the onLoad is supposed to fire upon the image loading. Is there an
event that I can trap for once the background image in
<BODY background="...url..."> is loaded?
I plan to render a series of maps which sometimes take a while to
compute (on the server) so I'd like to know when subsequent ones
come in.

Failing that, can I assign an already loaded image to the background?


Thanks,
Csaba Gabor from Vienna
 
H

hippo

Hi,

try this:
I have just posted a similar question, only my wish is to change it
due to the users screen resolution

<html>
<head>
<title>yourpage</title>
<SCRIPT language="JavaScript">
<!--
function setBackground() {
document.body.style.backgroundImage='url(yourimage.jpg)';
}
//-->
</SCRIPT>
</head>
<body onLoad="setBackground()">
your html
</body>
</html>


Greetz,
Hippo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,126
Latest member
FastBurnketoIngredients
Top