[thelist] Re: dynamically creating comments with JavaScript...

Thomas K. Selig thomas.selig at gmx.net
Sun Feb 24 15:44:01 CST 2002


>Message: 5
>From: "Peter-Paul Koch" <gassinaumasis at hotmail.com>
>To: thelist at lists.evolt.org
>Subject: Re: [thelist] dynamically creating comments with JavaScript
>& document.write
>Date: Sun, 24 Feb 2002 17:33:22 +0000
>Reply-To: thelist at lists.evolt.org
>
>
>
>><script language=JavaScript type="text/javascript">
>><!--
>>	Browser = Aktiv();
>>	if(Browser) {
>>		document.write("<!--");
>
>The HTML parser of the browser may find the start a new tag here: start of
>an HTML comment that comments out the /script and the content.
>This won't happen in all browsers but it might happen in some.
>
>>	}
>>//-->
>></script>
>>
>>.....Code that is supposed to be commented away
>>.....Code that is supposed to be commented away
>>.....Code that is supposed to be commented away
>>
>><script language=JavaScript type="text/javascript">
>><!--
>
>Here the HTML parser finds a start of a comment.
>
>>	Browser = Aktiv();
>>	if(Browser) {
>>		document.write("-->");
>
>Here any HTML parser of any browser is certain that either the comment or
>the script tag (or both) has ended and it should normally display the
>following text: "); } //-->
>
>>	}
>>//-->
>></script>
>
>>Any help would be highly appreciated.
>
>Not sure this can be done at all in JavaScript. Obviously you could try to
>write &lt; and &gt; instead of the < and > but if any browser made it a
>start and end of a tag I'd be highly surprised.

Tried this already earlier, but the browser I tested it with (IE,
Netscape 4.7, Netscape 6, Opera, all on Mac and Win), did not
recognize &lt; in the document.write as start of a tag...

/Thomas
--









More information about the thelist mailing list