Using IE 6/7/8, I receive a JavaScript error code.
The line of code is:
document.getElementById('all').style.backgroundColor = color;
The IE 6/7/8 is:
Invalid property value
Thanks in advance!
Using IE 6/7/8, I receive a JavaScript error code.
The line of code is:
document.getElementById('all').style.backgroundColor = color;
The IE 6/7/8 is:
Invalid property value
Thanks in advance!
Are you running this code after the DOM is completely loaded? Perhaps there is no 'panel-hlisting-all' yet? If you're using Prototype, you might try:
document.observe("dom:loaded", function() { // Wait until everything is loaded.
document.getElementById('panel-hlisting-all').style.background = color;
});
Just a thought — and I have no way of testing it on IE (thankfully/unfortunately), but what if you tried:
document.getElementById('panel-hlisting-all').style.backgroundColor = color;
Added:
Also note that color
must be a string containing a valid CSS color (#FFFFFF
, rgb(255,255,255)
, rgba(255,255,255,1)
).
There no such thing as .style.background
in JavaScript. Use .style.backgroundColor
.
Since you're trying to set the backgroundColor
when you get this error, my guess would be that the property whose value is invalid - is backgroundColor
!
Set a breakpoint on that line and find out what value color
has.