Is there a way round the invalid markup for javascript? My fixes was going so well until i tried a validation.
I was going to post 15 error messages but then thought no ones going to want to read through them all. I'm hopeing theres a simple fix.
Page 1 of 1
Javascript & W3C Validation
#3
Posted 22 July 2009 - 06:33 PM
Yes thats true so here goes,
Line 18, Column 44: character "&" is the first character of a delimiter but occurred as data
if ((version >= 5.5) && (version < 7) && (document.body.filters)) ✉
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.
Line 25, Column 29: an attribute specification must start with a name or name token
var strNewHTML = "<span " + imgID + imgClass + imgTitle✉
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).
Line 25, Column 29: document type does not allow element "span" here
var strNewHTML = "<span " + imgID + imgClass + imgTitle
Line 80, Column 132: Attribute "onload" exists, but can not be used for this element.
…one" width="250" height="21" onload="fixPNG(this)"/></h1>
Line 18, Column 26: XML Parsing Error: xmlParseEntityRef: no name
if ((version >= 5.5) && (version < 7) && (document.body.filters)) ✉
Line 18, Column 27: XML Parsing Error: xmlParseEntityRef: no name
if ((version >= 5.5) && (version < 7) && (document.body.filters)) ✉
Line 18, Column 38: XML Parsing Error: StartTag: invalid element name
if ((version >= 5.5) && (version < 7) && (document.body.filters)) ✉
Line 18, Column 43: XML Parsing Error: xmlParseEntityRef: no name
if ((version >= 5.5) && (version < 7) && (document.body.filters)) ✉
Line 18, Column 44: XML Parsing Error: xmlParseEntityRef: no name
if ((version >= 5.5) && (version < 7) && (document.body.filters)) ✉
Line 25, Column 28: XML Parsing Error: error parsing attribute name
var strNewHTML = "<span " + imgID + imgClass + imgTitle✉
Line 25, Column 28: XML Parsing Error: attributes construct error
var strNewHTML = "<span " + imgID + imgClass + imgTitle✉
Line 25, Column 28: XML Parsing Error: Couldn't find end of Start Tag span line 25
var strNewHTML = "<span " + imgID + imgClass + imgTitle✉
Line 30, Column > 80: XML Parsing Error: Opening and ending tag mismatch: script line 12 and span
… + "\', sizingMethod='scale');\"></span>"…✉
Line 35, Column 9: XML Parsing Error: Opening and ending tag mismatch: head line 3 and script
</script>✉
Line 47, Column 7: XML Parsing Error: Opening and ending tag mismatch: html line 2 and head
</head>
#4
Posted 22 July 2009 - 06:34 PM
If it's html errors being picked up inside your javascript, then just wrap your js in cdata tags.
<script> <--<![CDATA[ Javascript here ]]>--> </script>
#5
Posted 22 July 2009 - 06:41 PM
bocaj, on 22 July 2009 - 06:34 PM, said:
If it's html errors being picked up inside your javascript, then just wrap your js in cdata tags.
<script> <--<![CDATA[ Javascript here ]]>--> </script>
Hey, Thanks that seems to have worked for me i only get this error now:
Line 84, Column 132: Attribute "onload" exists, but can not be used for this element.
…one" width="250" height="21" onload="fixPNG(this)"/></h1>
Any way round this?
#6
Posted 22 July 2009 - 07:35 PM
Must have spoke to soon as it sorts out the validation to an extent but now leaves me with a syntax error for <![CDATA[.
any suggestions anyone.
any suggestions anyone.
Quote
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.30618; .NET CLR 3.5.30729; Media Center PC 5.0)
Timestamp: Wed, 22 Jul 2009 19:30:32 UTC
Message: Syntax error
Line: 13
Char: 1
Code: 0
URI: http://www.o18.org.uk/
Message: Object expected
Line: 84
Char: 1
Code: 0
URI: http://www.o18.org.uk/
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.30618; .NET CLR 3.5.30729; Media Center PC 5.0)
Timestamp: Wed, 22 Jul 2009 19:33:40 UTC
Message: Syntax error
Line: 13
Char: 1
Code: 0
URI: http://www.o18.org.uk/
Message: Object expected
Line: 84
Char: 1
Code: 0
URI: http://www.o18.org.uk/
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.30618; .NET CLR 3.5.30729; Media Center PC 5.0)
Timestamp: Wed, 22 Jul 2009 19:30:32 UTC
Message: Syntax error
Line: 13
Char: 1
Code: 0
URI: http://www.o18.org.uk/
Message: Object expected
Line: 84
Char: 1
Code: 0
URI: http://www.o18.org.uk/
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.30618; .NET CLR 3.5.30729; Media Center PC 5.0)
Timestamp: Wed, 22 Jul 2009 19:33:40 UTC
Message: Syntax error
Line: 13
Char: 1
Code: 0
URI: http://www.o18.org.uk/
Message: Object expected
Line: 84
Char: 1
Code: 0
URI: http://www.o18.org.uk/
#7
Posted 22 July 2009 - 07:44 PM
Sorry, my mistake. Typo
It should of been
Basically, <![CDATA[ Content ]]> tells the parser that it's character data and that it shouldn't try and validate it.
But you also need to comment out the cdata tags for the benefits of certain validators (like the one in dreamweaver so i believe). So we get
The CDATA start and end tags must ALWAYS be on their own lines as well.
It should of been
<script> <!--<![CDATA[ Javascript here ]]>--> </script>
Basically, <![CDATA[ Content ]]> tells the parser that it's character data and that it shouldn't try and validate it.
But you also need to comment out the cdata tags for the benefits of certain validators (like the one in dreamweaver so i believe). So we get
<!--<![CDATA[ Content ]]>-->
The CDATA start and end tags must ALWAYS be on their own lines as well.
#8
Posted 23 July 2009 - 08:40 AM
Thanks for your help bocaj, only error i'm left with now is a PNG fix. Does anyone know a way to get the following validated?
Line 84, Column 132: Attribute "onload" exists, but can not be used for this element.
…one" width="250" height="21" onload="fixPNG(this)"/></h1>
Line 84, Column 132: Attribute "onload" exists, but can not be used for this element.
…one" width="250" height="21" onload="fixPNG(this)"/></h1>
- ← Adding text into a class name list
- CSS, XHTML/HTML & JavaScript
- Playing sound on mouse over and defining images on/off →
Share this topic:
Page 1 of 1
Help
















