html code in <script>

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 UTC