Jump to content

how to change background image


pixeltrace

Recommended Posts

Hi,

 

i need help.

i need an effect in 1 of the page of my site wherein i will

need to change the background image of the page on a given delay time.

 

i tried this

  document.getElementById("LINK1").style.backgroundImage="image.gif";

 

 

but i need a delay on how the background image will load

 

i tried using the onLoad=Display('id', {delay:10.0}) inside the <body> tag

but its still not working

 

hope you could help me with this.

 

thanks!

 

Link to comment
https://forums.phpfreaks.com/topic/74292-how-to-change-background-image/
Share on other sites

--put this code in the HEAD section of your web page:

<script type="text/javascript">
body.onload = function() 
{ 
    setTimeout("document.getElementById("LINK1").style.backgroundImage='url(image.gif)';"
,5000); 
    // 5 seconds delay
    // notice that I set the backgroundImage to 'url(image.gif)' - that url() wrapper is necessary!
}
</script>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.