Page 1 of 1

Simple: Set body element's backgroundImage to 'none'?

Posted: Mon Apr 14, 2008 4:00 pm
by JAB Creations
Here is my attempt to remove the background-image (which I think is backgroundImage in JavaScript) from the body element though of course it's not working, suggestions?

Code: Select all

document.body.backgroundImage='none'; 

Re: Simple: Set body element's backgroundImage to 'none'?

Posted: Mon Apr 14, 2008 4:15 pm
by JellyFish
I think it depends on if your trying to set the CSS property or the background element attribute.

Element Attribute:

Code: Select all

document.body.background = "";
CSS Property:

Code: Select all

document.body.style.backgroundImage = "none";
two options there, or maybe three:

Get's rid of background color too:

Code: Select all

document.body.style.background = "none";

Re: Simple: Set body element's backgroundImage to 'none'?

Posted: Mon Apr 14, 2008 9:05 pm
by JAB Creations
Thanks, I ended up going with the following...

Code: Select all

document.body.style.backgroundImage='none';