CSS background color in JavaScript

How can I set the CSS background color of an HTML element using JavaScript?



Answer : 


In general, CSS properties are converted to JavaScript by making them camelCase without any dashes. So background-color becomes backgroundColor.
function setColor(element, color)
{
    element.style.backgroundColor = color;
}


source : http://stackoverflow.com/questions/3319/css-background-color-in-javascript