Jump to content
Larry Ullman's Book Forums

Can I Get Rid Of These Html Validation Errors Caused By Javascript?


Recommended Posts

I have affiliate links that are causing a lot of HTML validation errors. I do not understand Javascript very well. Is there any way I can fix these myself. The company has stopped making updates for me.

You will notice that the banners show the links and therefore look terrible. If I change the ShowURL form Y to N then the link does not click through. This is just cosmetic, though.

I've setup a test page so you can see the banners/links and you can validate that page to see all the errors. http://adviceofthequeen.com/test.php

Here is the first banner on that page:

<p class="centered"><abbr title="Manual Do It Yoursef-see home page for details.">MDIY</abbr>      free</p>
<div class="centered-banner">
<script type="text/javascript" src="http://www.the-tree-of-life.com/lib/jquery/jquery.js"></script>
<script type="text/javascript" src="http://www.the-tree-of-life.com/js/core.js"></script>
<script type="text/javascript">
//<![CDATA[
if (typeof(cart_banner) == "undefined") var cart_banner = new Array();
cart_banner[25] = {
BoxWidth: '236',
BoxHeight: '16',
OutlineColor: '#296DC1',
TitleTextColor: '#FDFDFD',
TextColor: '#333333',
TextBackgroundColor: '#F9F9FF',
ShowURL: 'Y' /* Y - yes; N - no*/
}
//]]>
</script>
<script id="id_script_banner_25" type="text/javascript" src="http://www.the-tree-of-life.com/index.php?dispatch=aff_banner.view&bid=25&type=js_content&sl=EN&product_ids=&aff_id=55"></script>
</div>

And this is the second banner:
 

<div class="centered-banner">
<script type="text/javascript" src="http://www.the-tree-of-life.com/lib/jquery/jquery.js"></script>
<script type="text/javascript" src="http://www.the-tree-of-life.com/js/core.js"></script>
<script type="text/javascript">
//<![CDATA[
if (typeof(cart_banner) == "undefined") var cart_banner = new Array();
cart_banner[28] = {
BoxWidth: '236',
BoxHeight: '16',
OutlineColor: '#296DC1',
TitleTextColor: '#FDFDFD',
TextColor: '#333333',
TextBackgroundColor: '#F9F9FF',
ShowURL: 'Y' /* Y - yes; N - no*/
}
//]]>
</script>
<script id="id_script_banner_28" type="text/javascript" src="http://www.the-tree-of-life.com/index.php?dispatch=aff_banner.view&bid=28&type=js_content&sl=EN&product_ids=&aff_id=55"></script>
</div>

This is some of the errors which I have edited to reduce length:

 

W3C Markup Validation Service
Errors found while checking this document as XHTML 1.0 Transitional!
Result:     15 Errors, 25 warning(s)

Validation Output: 15 Errors

    Warning Line 88, Column 129: cannot generate system identifier for general entity "bid"
    …om/index.php?dispatch=aff_banner.view&bid=25&type=js_content&sl=EN&product_ids…
    Error Line 88, Column 129: general entity "bid" not defined and no default entity
    …om/index.php?dispatch=aff_banner.view&bid=25&type=js_content&sl=EN&product_ids…

    Warning Line 88, Column 132: reference not terminated by REFC delimiter
    …index.php?dispatch=aff_banner.view&bid=25&type=js_content&sl=EN&product_ids=&a…
    Warning Line 88, Column 132: reference to external entity in attribute value
    …index.php?dispatch=aff_banner.view&bid=25&type=js_content&sl=EN&product_ids=&a…

    Warning Line 88, Column 136: cannot generate system identifier for general entity "type"
    …x.php?dispatch=aff_banner.view&bid=25&type=js_content&sl=EN&product_ids=&aff_i…
    Error Line 88, Column 136: general entity "type" not defined and no default entity
    …x.php?dispatch=aff_banner.view&bid=25&type=js_content&sl=EN&product_ids=&aff_i…
    Info Line 88, Column 135: entity was defined here
    …ex.php?dispatch=aff_banner.view&bid=25&type=js_content&sl=EN&product_ids=&aff_…

Link to comment
Share on other sites

That was a good idea, Larry, that I would not have thought of.

I ran the html5 test here http://adviceofthequeen.com/testhtml5.php

 It reduced the errors to 10.  But HTML5 will require significant changes to my layout and would only be worth it if it got rid of all the errors.

Here are the errors now:

W3C Markup Validation Service
Check the markup (HTML, XHTML, …) of Web documents
Errors found while checking this document as HTML5!
Result: 	10 Errors, 1 warning(s)

Validation Output: 10 Errors

    Error Line 87, Column 128: & did not start a character reference. (& probably should have been escaped as &.)
   …com/index.php?dispatch=aff_banner.view&bid=25&type=js_content&sl=EN&product_id…

    Error Line 87, Column 135: & did not start a character reference. (& probably should have been escaped as &.)
    …ex.php?dispatch=aff_banner.view&bid=25&type=js_content&sl=EN&product_ids=&aff_…

    Error Line 87, Column 151: & did not start a character reference. (& probably should have been escaped as &.)
    …=aff_banner.view&bid=25&type=js_content&sl=EN&product_ids=&aff_id=55"></script>

    Error Line 87, Column 157: & did not start a character reference. (& probably should have been escaped as &.)
    …=aff_banner.view&bid=25&type=js_content&sl=EN&product_ids=&aff_id=55"></script>

    Error Line 87, Column 170: & did not start a character reference. (& probably should have been escaped as &.)
    …=aff_banner.view&bid=25&type=js_content&sl=EN&product_ids=&aff_id=55"></script>

    Error Line 111, Column 128: & did not start a character reference. (& probably should have been escaped as &.)
    …com/index.php?dispatch=aff_banner.view&bid=28&type=js_content&sl=EN&product_id…

    Error Line 111, Column 135: & did not start a character reference. (& probably should have been escaped as &.)
    …ex.php?dispatch=aff_banner.view&bid=28&type=js_content&sl=EN&product_ids=&aff_…

    Error Line 111, Column 151: & did not start a character reference. (& probably should have been escaped as &.)
    …=aff_banner.view&bid=28&type=js_content&sl=EN&product_ids=&aff_id=55"></script>

    Error Line 111, Column 157: & did not start a character reference. (& probably should have been escaped as &.)
    …=aff_banner.view&bid=28&type=js_content&sl=EN&product_ids=&aff_id=55"></script>

    Error Line 111, Column 170: & did not start a character reference. (& probably should have been escaped as &.)
    …=aff_banner.view&bid=28&type=js_content&sl=EN&product_ids=&aff_id=55"></script>

I also ran a test for XHTML but that gave all the original errors.
Edited by abigail
Link to comment
Share on other sites

 Share

×
×
  • Create New...