Forum Moderators: open

Message Too Old, No Replies

W3C Validation Help for Frameset Page

         

Stealth1

8:07 am on Feb 23, 2010 (gmt 0)

10+ Year Member



I am trying to finish off validating my site and only have the following 2 errors showing. I am using the following DOCTYPE and everything else works fine.

HTML 4.01 Frameset

# Error Line 55, Column 32: document type does not allow element "BODY" here

<body onload="preloadImages();">



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).


Line 144, Column 7: end tag for "HTML" which is not finished

</html>



Most likely, you nested tags and closed them in the wrong order. For example <p><em>...</p> is not acceptable, as <em> must be closed before <p>. Acceptable nesting is: <p><em>...</em></p>

Another possibility is that you used an element which requires a child element that you did not include. Hence the parent element is "not finished", not complete. For instance, in HTML the <head> element must contain a <title> child element, lists (ul, ol, dl) require list items (li, or dt, dd), and so on.

tangor

8:46 am on Feb 23, 2010 (gmt 0)

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



Appears you have a javascript statement included in the body element. This, I believe, would be more suited to a jscript in the head statement...

tedster

10:56 am on Feb 23, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How about the <head> section - is there a closing tag for it and any elements that were opened at the toop of the source code?

Fotiman

2:04 pm on Feb 23, 2010 (gmt 0)

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



If you are using a Frameset doctype, then you can't have a <body> element, you must have a <frameset>. You would need to switch to a non-frameset doctype.

tedster

3:55 pm on Feb 23, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ah, bingo! Fotiman nails it, I think.

Stealth1

4:10 am on Feb 24, 2010 (gmt 0)

10+ Year Member



I tried the other DOCTYPES but they all screwed up the layout of the webpage pretty badly.

Is there something I can change it to so that it keeps the onload part? I tried to put it into the css body section but it didn't work.

tedster

4:56 am on Feb 24, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's not the doctype you need to change - the point is that you can't use the <body> element and still validate.

Try switching to <frameset onload="preloadImages();"> and </frameset> instead.

Fotiman

5:01 am on Feb 24, 2010 (gmt 0)

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



Note, the only difference between the HTML 4.01 Frameset and the HTML 4.01 Transitional doctypes is that one allows the frameset, and the other allows body. It sounds like maybe you are using a complete doctype in one instance, and not a complete doctype in the other (so one is triggering quirks mode, which would cause layout problems). Can you post the complete doctype code that you are trying in both cases?

Stealth1

10:05 am on Feb 24, 2010 (gmt 0)

10+ Year Member



Ah, I must not have tried transitional as I just did and it is working perfectly. I think it was strict and loose that I tried before.

Thanks for the quick help!