PDA

View Full Version : a line of javascript code causing error in IE



qmqmqm
February 18th, 2009, 10:32 PM
Hi

This line of javascript code is causing errors in IE.


document.write("<TD bgColor=" background_color + ">" + validity_status + "</TD>");

I spent a long time but cannot figure out what's wrong with this line of code...

Any ideas anyone?

Thanks,

Tom

simeon87
February 18th, 2009, 10:35 PM
There's no plus after the first string. And you'd need to escape the quotation marks for the value of bgColor, so:



document.write("<TD bgColor=\"" + background_color + "\">" + validity_status + "</TD>");