The W3C XHTML validator will complain if you’ve got JavaScript embedded in your XHTML markup and you haven’t taken steps to make it XHTML friendly.
Either move the JavaScript into a file (in this example called script.js):
<script src="script.js" type="text/javascript"></script>
Or add CDATA tags around the JavaScript that’s embedded in the markup:
<script type="text/javascript">
<![CDATA[
... unescaped script content ...
]]>
</script>