joecoolaug Posted August 15, 2006 Share Posted August 15, 2006 I need to change the background image of my site with a function or something.I want an image changed, not the color, so can someone please help? If JS can't do it, can you please tell me the CSS or VBScript or whatever code that will? The JS code is below... please change it so it will work . Soooo... tired.... <html><head><script type="text/javascript">function change(){document.background="img.gif"}\\I'm way too tired to take the time to test this, so can someone tell me if this works or not?</script></head><body background="IMaGe.png" onLoad="change()"></body></html> Link to comment Share on other sites More sharing options...
reportingsjr Posted August 15, 2006 Share Posted August 15, 2006 first off.. why would you need to do this? are you trying to make it so the background changes when its all the way done loading? Link to comment Share on other sites More sharing options...
skym Posted August 15, 2006 Share Posted August 15, 2006 <html><head><script type="text/javascript">function change(){document.getElementById('myBody').style.backgroundImage = 'url(img.gif)';}</script></head><body background="IMaGe.png" onLoad="change()" id="myBody"></body></html> http://www.w3schools.com/htmldom/dom_obj_style.aspBtw, use slashes, not backslashes for comments. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now