I am trying to format this line of code in my popup window, but i am facing unterminated string literal error.
Can somebody please tell me how best I could format this.
window.setTimeout("winId.document.write('<script src="../js/tiny_mce/tiny_mce.js" type="text/javascript"></script>\n')", 10);
Also point out if this particular line of code would work fine in the popup?
Best not to use a string, but an anonymous function instead:
Using strings in setTimeout and setInterval is closely related to
eval(), and should only be used in rare cases. See http://dev.opera.com/articles/view/efficient-javascript/?page=2It might also be worth noting that
document.write()will not work correctly on an already parsed document. Different browsers will give different results, most will clear the contents. The alternative is to add the script using the DOM: