Jump to content

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>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.