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:28
W3C validation - anyone help please ?
Poster: gtatler
Dated: Friday October 21 2005 - 10:47:53 BST
My pages validated before using Milonic Version 5.733
I am using it in a table cell and the coding is as follows
<!-- ***** This is the section of code you need to paste into your web page *****-->
<script type="text/javascript" src="milonic_src.js"></script>
<a class="milonic" href="http://www.milonic.com/">JavaScript DHTML Drop Down Menu
By Milonic</a>
<script type="text/javascript">
if(ns4)_d.write("<scr"+"ipt type=text/javascript src=mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt type=text/javascript src=mmenudom.js><\/scr"+"ipt>");
</script>
<script type="text/javascript" src="menu_data.js"></script>
Now I get the following errors.
RESULTS.
Below are the results of checking this document for XML well-formedness and validity.
Error Line 56 column 21: an attribute specification must start with a name or name token.
if(ns4)_d.write("<scr"+"ipt type=text/javascript src=mmenuns4.js><\/scr"+"ipt>")
An attribute name (and some attribute values) must start with one of a restricted set of characters. This error usually indicates that you have failed to add a closing quotation mark on a previous attribute value (so the attribute value looks like the start of a new attribute) or have used an attribute that is not defined (usually a typo in a common attribute name).
✉
Error Line 56 column 21: element "scr" undefined.
if(ns4)_d.write("<scr"+"ipt type=text/javascript src=mmenuns4.js><\/scr"+"ipt>")
You have used the element named above in your document, but the document type you are using does not define an element of that name. This error is often caused by:
incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Frameset" document type to get the "<frameset>" element),
by using vendor proprietary extensions such as "<spacer>" or "<marquee>" (this is usually fixed by using CSS to achieve the desired effect instead).
by using upper-case tags in XHTML (in XHTML attributes and elements must be all lower-case.
✉
Warning Line 56 column 65: character "<" is the first character of a delimiter but occurred as data.
...te("<scr"+"ipt type=text/javascript src=mmenuns4.js><\/scr"+"ipt>");
This message may appear in several cases:
You tried to include the "<" character in your page: you should escape it as "<"
You used an unescaped ampersand "&": this may be valid in some contexts, but it is recommended to use "&", which is always safe.
Another possibility is that you forgot to close quotes in a previous tag.
✉
Error Line 57 column 21: an attribute specification must start with a name or name token.
else _d.write("<scr"+"ipt type=text/javascript src=mmenudom.js><\/scr"+"ipt>".
✉
Error Line 57 column 21: element "scr" undefined.
else _d.write("<scr"+"ipt type=text/javascript src=mmenudom.js><\/scr"+"ipt>".
✉
Warning Line 57 column 65: character "<" is the first character of a delimiter but occurred as data.
...te("<scr"+"ipt type=text/javascript src=mmenudom.js><\/scr"+"ipt>");
✉
Error Line 58 column 8: end tag for "scr" omitted, but OMITTAG NO was specified.
</script>
You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".
✉
Info Line 57 column 17: start tag was here.
else _d.write("<scr"+"ipt type=text/javascript src=mmenudom.js><\/scr"+"ipt>".
Error Line 58 column 8: end tag for "scr" omitted, but OMITTAG NO was specified.
</script>
✉
Info Line 56 column 17: start tag was here.
if(ns4)_d.write("<scr"+"ipt type=text/javascript src=mmenuns4.js><\/scr"+"ipt>")
Error Line 88 column 7: required attribute "type" not specified.
<script>
The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.
Typical values for type are type="text/css" for <style> and type="text/javascript" for <sc
Poster: Andy
Dated: Friday October 21 2005 - 13:06:46 BST
What is happening is the validator is cheking the JavaScript and obviously finding fault as it's not HTML.
However, there's not much we can do about that because the validator should not be looking at JavaScript and thus will not be a problem.
You could try adding <!-- and //--> inside the script tags like this:
Code:
<script>
<!--
JAVASCRIPT HERE
//-->
</script>
<!--
JAVASCRIPT HERE
//-->
</script>
Although this will break the menu in Netscape 4
Hope this helps,
Andy