Forum Moderators: open

Message Too Old, No Replies

Why won't this validate?

HTML validation question

         

marilyndwalker

9:24 pm on Dec 1, 2010 (gmt 0)

10+ Year Member



I am working with an old site and trying to clean it up before we do any more modifications. When I first took over, there was no doctype, so I started just trying to validate to a specific doctype. There is something in the head section that is making the validator trip up on the body tag. It keeps telling me that it doesn't belong there. I tried two different validators with the same result.

The entire section before that is included here. I cannot see anything there is that not a valid head section, with a proper closing tag.

Thanks for any help!

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>HOMER Energy - Hybrid Renewable and Distributed Power Design Support</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="google-site-verification" content="ypNUWG7sGr8oNL5V6A5OZsCsftVPbc2K3-e1PjhvLVg">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="icon" href="/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link href="styles/main.css" rel="stylesheet" type="text/css">
<style type="text/css">
.billcontent{
background-color: #FFF;
}
.testimonial-text
{
background-color: #FFF;
}
.rightcol {
font-size:11px;
}
.rightcol li {
list-style-image: url(../images/arrow_blksm.gif);
text-align: left;
font-size: 11px;
}
</style>
<script src="javascript/testimonials.js" type="text/javascript"></script>
<script type="text/javascript" src="javascript/global.js"></script>
<script language="javascript" type="text/javascript">
function loginInput()
{
var login = window.loginFrame.document.loginForm.username.value;
var password = window.loginFrame.document.loginForm.password.value;

document.hiddenLoginForm.username.value = login;
document.hiddenLoginForm.password.value = password;
document.hiddenLoginForm.submit();

}
</script>
</head>
<body>

SuzyUK

9:43 pm on Dec 1, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



it's the Doctype, if that was a frameset document it would not have anything else (e.g. scripts) in it

try:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

instead of:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">


PS: my manners are atrocious! sorry.. Welcome to WebmasterWorld marilyndwalker

[edited by: SuzyUK at 9:47 pm (utc) on Dec 1, 2010]

Fotiman

9:44 pm on Dec 1, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The problem is that you have specified a Frameset DOCTYPE, and Framesets do not contain a body element.

You should probably use either an HTML5 doctype:

<!DOCTYPE html>

HTML 4.01 Strict doctype:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

or HTML 4.01 Transitional doctype:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">

marilyndwalker

9:51 pm on Dec 1, 2010 (gmt 0)

10+ Year Member



OK thanks. There is an inline frame later in the document, but I take it that the frameset spec is not necessary for that? I haven't used frames much.

alt131

9:52 pm on Dec 1, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld marilyndwalker ;), and good on you for cleaning up first.

To add to the above advice: If you really do have frames you need to use the doctype you already have, but use <frameset> rather than <body>.

The recommendation [w3.org] has an example document. Even if you aren't using frames you may find it interesting because it makes it really esy to see why your document was failing validation.

tedster

10:03 pm on Dec 1, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is an inline frame later in the document, but I take it that the frameset spec is not necessary for that?

That is correct. The frameset DTD only applies to the actual <frame> attribute.

In fact, in HTML 5, the <iframe> element will still be supported, but not the <frame> element. Reference [w3schools.com]