Monday, March 3, 2008

Changing style(background color) via javascript

Your pretty close the JavaScript style properties are slightly different to the CSS style properties.
Mostly for the JavaScript version you use lowercase first word and upper case first letter of second word with no space or hyphen.

So background-color becomes backgroundColor.
Hope that helps.


       function changeCss(divid){            
          document.getElementById(divid).style.backgroundColor="#e0e0e0;";        
        }

No comments:

Post a Comment