|
One thing to be careful about:
<script type="text/javascript">
if (something < bla) {
// ....
}
</script>
Suddenly your document becomes invalid. Because Javascript extensively uses the <, >, and & signs, you either need to replace all occurrences of them with:
&lt; --> "<"
&gt; --> ">"
&amp; --> "&"
But since that will definitely cause issues with browsers not truely supporting XHTML, you put the entire script in a <![CDATA script contents ]]> section. Once again though you run into older browser support, which is finally solved by a little hack:
<script type="text/javascript">
<!--// <![CDATA
//script contents
// ]]> -->
</script>
Also, if you dynamically generate any content, be sure you generate valid markup. (Using W3C DOM methods automatically takes care of it for you, but be wary with innerHTML and the such.)
|