W3C home > Mailing lists > Public > www-html@w3.org > November 2007

html code in <script>

From: Paul Kieffer <paulkieffer@freenet.de>
Date: Tue, 13 Nov 2007 13:27:49 -0600
To: www-html@w3.org
Message-ID: <E1Is1RZ-0006Pm-UT@aji.w3.org>

One often finds discussion on using <noscript> if the user has 
javascript disabled. The use of the <script> and <noscript> code is 
not equal, though, since you can use html code in a <noscript> 
section, but not in a javascript <script> section.

What about the web page where you want something run only if the 
visitor has javascript enabled and you don't care to use <noscript>?

This webpage:

www.ucog.org/news1.php?strArticle=NEWS/2007-10-20.htm

fails to validate with 1 error because I used "<a href" in a 
javascript <script> section. I know the rule on this. :-) It also 
doesn't validate, either, if I put the script in an external file.

However, the code works perfectly: If the user has javascript enabled 
(Firefox and IE6), he sees the button above the validation icons 
"Print window". If he has javascript disabled, he doesn't see the button.

I'm not disputing the rule, I just find it illogical that html code 
cannot be used equally in <script> and <noscript> code sections.
Received on Tuesday, 13 November 2007 19:32:42 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:16:12 GMT