Forum Moderators: open
for some reason I can't get a <noscript> block to validate in my pages... I didn't have this problem before (a few days ago), but with the "new-look" W3C Validator I get this bizarre error:
[validator.w3.org...]
Line 103, column 9: document type does not allow element "noscript" here; missing one of
"object", "applet", "map", "iframe", "button", "ins", "del" start-tag
I've checked and re-checked but my tired eyes can't find anything wrong with the HTML...
I've also created a test.html page which has nothing but the <noscript></noscript> tags and this fails to validate also.
[validator.w3.org...]
can anyone tell me what I'm missing here? (sorry about the bad source formatting -- I'm using phpCMS and unfortunately it strips all the indenting from your source HTML)
ta, cheers
noscript element, cannot be contained within a paragraph (p) element. A list of valid elements it can be contained in can be found here [htmlhelp.com].
I suspect the W3C Validator might've been buggy, because I've had the same HTML code for several weeks and it never raised a complaint before.
thanks moonbiter :)
actually I've got another question... if I can't use <noscript> inside the <p> tags, that's really annoying, because I'd like all my content to be properly formatted in paragraph tags (which is also semantically correct)... and I'm using an anti-spam mailto javascript that generates the <noscript> tags, hence my dilemma. Is there anything similar to <p> that I can use the <noscript> tags in while still creating valid and semantically correct HTML code?
I'm currently using <blockquote> in place of the <p> tag, but that is a hack workaround and not semantically correct :(
and also: why did the W3C make it illegal to use <noscript> inside <p> tags? It just doesn't make any sense to me... :(
ah bugger it...
Is there anything similar to <p> that I can use the <noscript> tags in while still creating valid and semantically correct HTML code?
Well,
div is a generic container element that you could use for this. But I don't see why you don't do something like: <p>Blah blah blah</p>
<p><script type="text/javascript">function whatever()</script></p>
<noscript><p>Your noscript content</p></noscript>
My suspicion is that the script could be modified in some way to allow you to do what you want. Or do you not have the option modifying the anti-spam javascript?
why did the W3C make it illegal to use <noscript> inside <p> tags? It just doesn't make any sense to me
That, I would agree with. It seems insane that they would allow the
script element inside a paragraph (they do [htmlhelp.com]) but not the noscript element.
you're right about the javascript rewriting, but it's not practical in this case because I'm planning to use the (PHP-generated) anti-spam mailto Javascript in a variety of contexts, most of them inline within sentences, so it would be irksome to have to include an entire sentence block anew every time I used the script :)