Reputation: 1181
I am trying to validate my code using w3c-validator
Encoding: utf-8
Doctype:XHTML 1.0 Frameset
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Openfire Archived IM content Search</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
</head>
<body>
<p>
<!--The following javascript function re-directis the user to the same page-->
<script type="text/javascript">
function startover(){
window.location="http://localhost/openfireIMsearch/index.php"
}
</script>
<!--html form for start-over button. The javascript function startover() is called when the user clicks this button-->
<form method="get" action= "index.php" name = "re-login">
<input type = "button" value ="Start Over" onclick = "startover()" />
<input type = "hidden" name = "re-login-hidden" value ="re-login-on" />
</form>
</p>
</body>
</html>
I am getting the following error which I have no clue about:
Line 7, Column 6: document type does not allow element "body" here ✉ 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). One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).
Error message seems to indicate that one reason could be my use of meta tag. But the doctype clearly indicates that the document is XHTML and not HTML. I am at loss here. Could anybody shed some light? Thanks!
Upvotes: 0
Views: 674
Reputation: 27627
Your doctype seems to be telling me that it is a frameset. This would make body tags illegal and you would instead expect to have a frameset instead. Its a while since I've done any frames though so I might be misremembering that.
And in case its not obvious the solution would be to find the correct doctype. Something like:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
http://www.w3.org/QA/2002/04/valid-dtd-list.html seems to have a list to choose from (and is where I copied the above from).
Upvotes: 3