Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:05

trouble validating in XHTML


Poster: alabuc
Dated: Wednesday October 27 2004 - 3:36:09 BST

i've previously had some issues validating with the menu in HTML but thanks to you guys i got those all straightened out... now for XHTML 1.0 Strict. :( im not really sure what the problem is but here's the site i'm working on.

http://www.alabu.com/ibc/

and the validation link:

http://validator.w3.org/check?uri=http% ... ly%29&ss=1

if anyone knows how to fix those two errors (it was originally 10 but it messed with it until i got it down to 2) i would very much appreciate it. Thanks!

~Hal


Poster: John
Dated: Wednesday October 27 2004 - 4:04:30 BST

Haven't tried strict yet, but this looks wrong anyway. You have...
Code:
<script src="java/milonic_src.js" type="text/javascript"></script>
<script type="text/javascript">
if(ns4)_d.write("<script type='text/javascript' src='java/mmenuns4.js'>");
else _d.write("<script type='text/javascript' src='java/mmenudom.js'>");
</script>
</script>
</script>
<script src="java/menu_data.js" type="text/javascript"></script>

You can't have 3 </script> in a row like that. It implies nested scripts, which I'm pretty sure is a no-no. Besides, there are too many. With your code it should look like this...
Code:
<script language="javascript" src="java/milonic_src.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
if(ns4)_d.write("<script type='text/javascript' src='java/mmenuns4.js'>");
else _d.write("<script type='text/javascript' src='java/mmenudom.js'>");
</script>
<script language="javascript" src="java/menu_data.js" type="text/javascript"></script>

You also left out the language="javascript", which I put back in. I'm not sure about the changes you made to the ns4 and dom rows. That may be for strict.

Andy's code is...
Code:
<script language="javascript" src="/menu5/milonic_src.js" type="text/javascript"></script>
<script language="javascript">
<!--
if(ns4)_d.write("<scr"+"ipt language=javascript src=/menu5/mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=javascript src=/menu5/mmenudom.js><\/scr"+"ipt>");
-->
</script>
<script language="javascript" src="/menu5/menu_data.js" type="text/javascript"></script>

I got around a transitional error cleanly by using the <!-- --> stuff.

HTH...


Poster: alabuc
Dated: Wednesday October 27 2004 - 4:37:14 BST

Thank you!! looks like the <!-- --> is what fixed it... as far as taking language out. the XHTML 1.0 strict validator told me its not a valid attribute, and also that type is a required attribute(:D dont ask me i dont keep up with these rules)... and same thing with the three </script> in a row, the validator told me i had omitted them so i kept adding them until it stopped complaining (i think it got jacked up from the IF test and stuff) anyways, this is the code that validated for me:

Code:
<script src="/ibc/java/milonic_src.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
if(ns4)_d.write("<scr"+"ipt type=\"text\/javascript\" src=\"\/ibc\/java\/mmenuns4.js\"><\/scr"+"ipt>");
else _d.write("<scr"+"ipt type=\"text\/javascript\" src=\"\/ibc\/java\/mmenudom.js\"><\/scr"+"ipt>");
-->
</script>
<script src="/ibc/java/menu_data.js" type="text/javascript"></script>


EDIT: For anyone else with this issue... make sure you enclose your attributes with \"attribute\" because quotes are required in XHTML 1.0 strict. The \ before the quote is an escape character which allows it to print an actual quotation mark instead of ending the current quotation(because its already inside quotation marks). same thing goes for /'s you have to escape them as \/ in order for it to read it properly...mmm hope thats not too confusing


Poster: John
Dated: Wednesday October 27 2004 - 14:47:30 BST

Glad that worked (but I'm not going to go back and re-val as strict the 300+ pages I'm working on right now !). :roll:


Poster: Maz
Dated: Wednesday October 27 2004 - 16:44:03 BST

Interesting, although I don't get any errors using CDATA around js.
//<![CDATA[

//]]>

maz


Poster: John
Dated: Wednesday October 27 2004 - 16:58:01 BST

As mentioned, CDATA is only needed if there are certain special characters contained in the JS (posted a list someplace here). Also, I've heard stories about IE having fits with CDATA, which I have seen here. Never have been able to get a CDATA page to validate, either.


Poster: Maz
Dated: Thursday October 28 2004 - 0:45:55 BST

John,

CDATA always validates it even says to use it to hide code.

I was experimenting with that above and got different errors in different browsers.

maz


Poster: John
Dated: Thursday October 28 2004 - 4:48:59 BST

Don't know what to tell you, Maz. Any time I try validating with it in there the W3C validator (which obviously has nothing to do with any browser) always throws a fit.