W3C will not validate my menu with <br>

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
mark1
Advanced
Advanced
Posts: 12
Joined: Fri Apr 01, 2005 2:32 pm

W3C will not validate my menu with <br>

Post by mark1 »

Hi I want to have a line break and indent on a couple of menu items. Easy enough <br />&nbsp;&nbsp;. Problem is I get an error message when validating the page.
Do I have another option? I tried <br /> ang got more errors when validating the page.
Line 67, column 30: document type does not allow element "br" here

aI("text=Education<br />&nbsp;&nbsp;&nbsp;Programs;showmenu=education;");

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).
Thanks
Mark
BigWebGuy
Advanced
Advanced
Posts: 15
Joined: Wed Apr 27, 2005 5:05 pm

Post by BigWebGuy »

you need to escape your / with a \ like below:

Code: Select all

aI("text=Education<br \/>&nbsp;&nbsp;&nbsp;Programs;showmenu=education;"); 
same if you would need to output double quotes:

Code: Select all

aI("text=\"Education<br \/>&nbsp;&nbsp;&nbsp;Programs\";showmenu=education;"); 
mark1
Advanced
Advanced
Posts: 12
Joined: Fri Apr 01, 2005 2:32 pm

Post by mark1 »

Thanks GigWebGuy This gave me quotes in the menu and this error message when validating. I have also tried "li". It works but I get the same error message with the exception "br" is now "li".
Line 67, column 31: document type does not allow element "br" here

aI("text=\"Education<br \/>&nbsp;&nbsp;&nbsp;Programs\";showmenu=educatio

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).
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

It's not your code (obviously). It's simply that the checker does not understand the syntax of the aI statement, which, not being XHTML, gets flagged (in this case because the <br /> is "out of place").
John
mark1
Advanced
Advanced
Posts: 12
Joined: Fri Apr 01, 2005 2:32 pm

Post by mark1 »

Thanks John

Well it works as coded so leave well enough alone :)
Don't fix it if it ain't broke
Thanks for everyone's help and the great menu system.

Mark
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

You're welcome, Mark.

I've run into the same problem. If you're not getting validation errors anywhere else in your code you know you're 'clean'.
John
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

What doctype are you using? Would it be because <br> is depreciated for your particular doctype?

Did you try just a plain ol <br> without the slash?

Random thoughts...

Kevin
Post Reply