Jag vill låta besökare direktlänka till en viss frågesport mha ett stycke html-kod som de får kopiera rakt av. Tyvärr skriker validatorn 4 ggr på denna korta kod och jag fattar inte varför! Hjälp!
I princip (vissa texter och URLar förkortade) HTML 4.01 Transitional
<p>Copy the text below to get the Banner to appear on your own page. <img src="http://.../smile.gif" alt="*smile*"> </p>
<textarea rows=6 cols=70><a href="http://..../fil.php?id=7" target="_blank"><img src="http://.../bild.gif" alt="text"><br>
<font face="'Bookman Old Style', serif" size="1" color="#DC143C"><strong>Where do you belong?</strong><br>
Welcome!</a></font></textarea></p>
Validatorn klagar på:
<a href="http://..../fil.php?id=7" target="_blank"><img src= The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).
Va?
Welcome!</a**>**</font></textarea></p> You forgot to close a tag, or you used something inside this tag that was not allowed, and the validator is complaining that the tag should be closed before such content can be allowed.
Vad är det jag inte får använda?
Samma fel för båda dessa ställen:
Welcome!</a></font**></textarea></p>
Welcome!</a></font></textarea></p>** The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.
Nähä? Följdfel? Eller vadå?
Intressant... När jag tog bort den felande </p>-taggen och fixade till ordningen på taggarna, försvann alla fel utom ett:
Line 65, Column 256: document type does not allow element "FONT" here.
…yle', serif" size="1" color="#DC143C"><a href="http://...
The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).
Eftersom koden är avsedd för folks signaturer o.dyl. vill jag ju att det ska fungera utan att ligga i head. Är det omöjligt?
Det är de inte, förutom kanske när du vill skriva "</textarea>" i din textarea... att validatorn klagar har att göra med att den använder en SGML parser och textarea är deklarerad som PCDATA i DTDn istället för RCDATA som hade varit närmare vad webbläsare gör.
Validerings felet om FONT betyder att du fortfarande stängt </font> på fel ställe.
Om man tittar på din gamla kod så ska de byta plats så här </font></a>