You are using quotes " to tell Javascript where the string ends. So when you also use it to start and end the HTML property, it makes things confusing and it doesn't parse correctly.
Simply replace the embedded "s with \".
Code:
document.writeln("<tr><td style=\"background-color:#FFFF00;\">" + "test" + "</td></tr>");
Alternatively you can alternate single and double quotes. It looks a bit more elegant, though it can be a little harder to remember.
Code:
document.writeln('<tr><td style="background-color:#FFFF00;">' + 'test' + '</td></tr>');
Bookmarks