It is better not to use a string, but an anonymous function:
window.setTimeout(function () { winId.document.write( '<script src="../js/tiny_mce/tiny_mce.js" type="text/javascript"></script>\n' ); }, 10);
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=2
It can also be noted that document.write() will not work correctly with an already parsed document. Different browsers will give different results, most of them will clear the content. An alternative is to add a script using the DOM:
window.setTimeout(function () { var winDoc = winId.document; var sEl = winDoc.createElement("script"); sEl.src = "../js/tiny_mce/tiny_mce.js"; winDoc.getElementsByTagName("head")[0].appendChild(sEL); }, 10);
source share