Richard Harrington
Richard Harrington

Reputation: 41

XHTML Validation problem within Javascript

So, I read the W3C validation FAQ about why some javascript causes validation errors but didn't seem to find an answer regarding my problem.

If you try to validate http://www.proskimboarding.com/codingtest/Public/registration.php

you'll receive a bunch of errors within the javascript code... anyone know of a solution for this? (mainly involving ampersands)

Upvotes: 0

Views: 208

Answers (2)

Nick Craver
Nick Craver

Reputation: 630637

Your ampersands need to be & instead of just & when outside of javascript, inside javascript you need to use this style with your script tags:

<script type="text/javascript">
//<![CDATA[

alert("My Code here");

//]]>
</script>

Update: Tested this with your code, it solves 12/13 errors, the last is just not having a character encoding specified in the file, which is minor.

Upvotes: 3

Dustin Laine
Dustin Laine

Reputation: 38553

Yes your & need to be encoded to &amp;

Upvotes: 0

Related Questions