pixeltrace Posted October 22, 2007 Share Posted October 22, 2007 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! Quote Link to comment https://forums.phpfreaks.com/topic/74292-how-to-change-background-image/ Share on other sites More sharing options...
mainewoods Posted October 22, 2007 Share Posted October 22, 2007 --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> Quote Link to comment https://forums.phpfreaks.com/topic/74292-how-to-change-background-image/#findComment-375651 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.