Forum Moderators: open

Message Too Old, No Replies

noscript and comments don't mix?

         

MindlessXD

3:38 am on Sep 28, 2005 (gmt 0)

10+ Year Member



<noscript><!--</noscript><script type="text/javascript" src="showhide.js" /><noscript>--></noscript>

This markup validates, but in both Firefox and IE (IE tells me that there is an error on the page), the script is completly ignored. Is this the way it's supposed to work? Shouldn't the comment tags be ignored because they are inside "noscript" tags?

Dijkgraaf

4:24 am on Sep 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just use
<script type="text/javascript" src="showhide.js" />
If the browser doesn't support javascript, then it won't be requesting the showhide.js file anyway, so you don't need to bother trying to enclose it inside comments for older browsers.

MindlessXD

2:26 am on Sep 29, 2005 (gmt 0)

10+ Year Member



When OffByOne reaches my script tag, it stops rendering the page, so that's why I was trying to hide it.

Dijkgraaf

3:24 am on Sep 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well I'd raise it as a bug with OffByOne, rather than trying to do something non-standard that is possibly going to cause other browsers grief.
Try the following as an alternative

<script type="text/javascript" src="showhide.js"></script>

It might just not understand the self closing tag.