<SCRIPT>var x = 1;</SCRIPT>
The context that matters is the HTML page, not the script block:
You may at some point find yourself writing a script that writes a script into some other browser window or frame. If you do this, you'll need to write out a </SCRIPT> tag to terminate the script you are writing. You must be careful, though--the HTML parser doesn't know about quoted strings, so if you write out a string that contains the characters "</SCRIPT>" in it, the HTML parser will terminate the currently running script.
To avoid this problem simply break this tag up into pieces, and write it out using an expression like "</" + "SCRIPT>":
<SCRIPT> f1.document.write("<SCRIPT>"); f1.document.write("document.write('<H2>This is the quoted script</H2>')"); f1.document.write("</" + "SCRIPT>"); </SCRIPT>