davidj.org

home ~ tools ~ song quotes ~ podcast ~ song lyric trivia ~ docs ~ links ~ archives ~ search ~ lycii ~ mail
internetbumperstickers.com

JavaScript Invalid Property Error

Suddenly, the script I had written just stopped working in IE. Firefox just fine, IE ... not so much.

I changed my onclick="document.getElementById('variableName').style.color='#f00;';" to onclick="document.getElementById('variableName').style.cssText='color:#f00;';" and IE worked just like Firefox, and Firefox continued to work.

I changed it back to style.color from style.cssText and got the JavaScript Invalid Property Error again.

I changed it back to style.cssText and IE and Firefox marched on. Opera didn't care either.

I don't know why this is. There was a time when the script was running fine in IE with style.color but that time ended as I went along and then the script only worked if I switched to style.cssText.

Baffling.

Submitted by - David Johnson