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

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

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

Post 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'; 
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

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

Post 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";
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

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

Post by JAB Creations »

Thanks, I ended up going with the following...

Code: Select all

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