PDA

View Full Version : Resolving w3c errors in script



clubamigos
03-01-2006, 03:04 PM
I am trying to valid a script to confirm to w3c standards but there are some errors in the script. As l did not write the script l am struggling to resolve the errors.

These are the errors.

Below are the results of checking this document for XML well-formedness and validity.

1. Error Line 38 column 28: character ";" not allowed in attribute specification list.

for (x=0; x<dynimages.length; x++){


2. Error Line 38 column 28: element "dynimages.length" undefined.

for (x=0; x<dynimages.length; x++){

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.


3. Error Line 47 column 41: character "'" is not allowed in the value of attribute "target".

imghtml='<a href="'+theimg[1]+'" target="'+optlinktarget+'">'

It is possible that you violated the naming convention for this attribute. For example, id and name attributes must begin with a letter, not a digit.


4. Error Line 48 column 62: required attribute "alt" not specified.

...+='<img src="'+theimg[0]+'" border="'+imgborderwidth+'">'

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


5. Error Line 48 column 63: end tag for "img" omitted, but OMITTAG NO was specified.

...'<img src="'+theimg[0]+'" border="'+imgborderwidth+'">'

You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".


6. Info Line 48 column 10: start tag was here.

imghtml+='<img src="'+theimg[0]+'" border="'+imgborderwidth+'">'

7. Warning Line 57 column 19: character "&" is the first character of a delimiter but occurred as data.

if (imgobj.filters && window.createPopup){

This message may appear in several cases:
* You tried to include the "<" character in your page: you should escape it as "&lt;"
* You used an unescaped ampersand "&": this may be valid in some contexts, but it is recommended to use "&amp;", which is always safe.
* Another possibility is that you forgot to close quotes in a previous tag.


8. Warning Line 57 column 20: character "&" is the first character of a delimiter but occurred as data.

if (imgobj.filters && window.createPopup){


9. Warning Line 62 column 19: character "&" is the first character of a delimiter but occurred as data.

if (imgobj.filters && window.createPopup)


10. Warning Line 62 column 20: character "&" is the first character of a delimiter but occurred as data.

if (imgobj.filters && window.createPopup)


11. Error Line 68 column 8: end tag for "dynimages.length" omitted, but OMITTAG NO was specified.

</script>


12. Info Line 38 column 11: start tag was here.

for (x=0; x<dynimages.length; x++){

13. Error Line 77 column 48: there is no attribute "onMouseover".

... width="20%"><a href="#" onMouseover="modifyimage('dynloadarea', 0)"><img bor

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. 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 "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute.


14. Error Line 77 column 167: unclosed start-tag requires SHORTTAG YES.

...e="css valid" width="50" height="50" </a><br>


15. Error Line 77 column 170: end tag for "img" omitted, but OMITTAG NO was specified.

...css valid" width="50" height="50" </a><br>


16. Info Line 77 column 80: start tag was here.

...over="modifyimage('dynloadarea', 0)"><img border="0" src="thumb1.jpg" alt="ph

17. Error Line 77 column 175: end tag for "br" omitted, but OMITTAG NO was specified.

...alid" width="50" height="50" </a><br>


18. Info Line 77 column 171: start tag was here.

...ss valid" width="50" height="50" </a><br>

19. Error Line 78 column 151: unclosed start-tag requires SHORTTAG YES.

...e="css valid" width="50" height="50" </a><br>


20. Error Line 78 column 154: end tag for "img" omitted, but OMITTAG NO was specified.

...css valid" width="50" height="50" </a><br>


21. Info Line 78 column 64: start tag was here.

...over="modifyimage('dynloadarea', 1)"><img border="0" src="thumb2.jpg" alt="ph

22. Error Line 78 column 159: end tag for "br" omitted, but OMITTAG NO was specified.

...alid" width="50" height="50" </a><br>


23. Info Line 78 column 155: start tag was here.

...ss valid" width="50" height="50" </a><br>

24. Error Line 79 column 151: unclosed start-tag requires SHORTTAG YES.

...e="css valid" width="50" height="50" </a></td>


25. Error Line 79 column 154: end tag for "img" omitted, but OMITTAG NO was specified.

...css valid" width="50" height="50" </a></td>


26. Info Line 79 column 64: start tag was here.

...over="modifyimage('dynloadarea', 2)"><img border="0" src="thumb3.jpg" alt="ph

27. Error Line 84 column 18: there is no attribute "height".

<table height="1-">


28. Error Line 93 column 109: end tag for "img" omitted, but OMITTAG NO was specified.

...idth="80" height="15" border="0"></td>


29. Info Line 93 column 11: start tag was here.

<td><img src="button_css.png" alt="css valid" title="css valid" width="80

mwinter
03-01-2006, 03:10 PM
I am trying to valid a script to confirm to w3c standards but there are some errors in the script.This is not an accessibility question, but one of markup and should be moved to the HTML forum.

The errors alone are not enough to correct the problems; you should provide a link to the document in question. However, by the look of things your problems are two-fold:


You are using XHTML (and serving it as HTML). Don't. Use HTML.
You are including a script in a document when you should instead export it to an external file and use the src attribute of the script element.
Mike

clubamigos
03-01-2006, 04:24 PM
Thanks for that help, l have now managed to resolve all the errors.

Please can this thread be closed.