Everyone is now upgrading their HTML to XHTML on web. It is important to make your webpages XHTML compliant. We have enlisted 2 methods to update your older pages into DHTML or JavaScript XHTML compliant.

Option 1: For inline JavaScript, you must wrap the code itself in the CDATA tag along with some clever use of JavaScript comments to let the validator know the content within the script should not be parsed for XHTML validation.

<script type="text/javascript">
//<![CDATA[
//The JavaScript code itself
//The JavaScript code itself
// etc...
//]]>
</script>

Option 2: The alternative and most popularly used method for making your JavaScript XHTML compliant is to remove the entire complicated script from your page, and place its contents inside an external JavaScript file, then reference this file on your web page.

<script type="text/javascript" src=”myscript.js”>
//Comment here
//Comment here
</script>