Test page for document.write issue

Here we execute the script (create foo())

More script (create bar())

Functions created: foo bar

Result:
If you see something like

if (see_this) { alert('trouble'); }
then the script has been broken by the "</script>" tag. As a result the function foo does not work. This does not happen on FF1.0 and Moz 1.7.
If DOCTYPE is not specified, then the page loads correctly.

Sites involved: everything that uses lycos banner, in particular wired.com and space.com.

Brief explanation:
This page includes a js library (test_docwri.js) with a single function. This function writes a bunch of document.write() each adding tags and code to the DOM.
The following part of the code creates a problem:

document.write ('document.write(');
document.write ("'");
document.write ('</SCRIPT> \\');
document.write ('n');
document.write ("'");
document.write (');\n');
The parser gets the </SCRIPT> as the end of the script itself, stops its execution and puts everything that follows in a text node. Hence the code appears on the page and other weird things may happen.

Update 5/10/2005: Escaping the foward slash does not solve the problem. JS code updated.
document.write ('<\/SCRIPT> \\');
The javascript code is still displayed on the page.

Your browser is: