[thelist] XHTML1.1 Validation errors with Javascript
Burhan Khalid
thelist at meidomus.com
Sun Oct 26 01:40:38 CST 2003
Tim Burgan wrote:
> Hello,
>
> I'm having problem. I've created a webpage to teach myself the basics
> of JavaScript (or programming in general).
>
> With my JavaScript, if I create an external (javascript.src) file and
> link it to my XHTML [1], my site validates with the W3C. But, if I
> have the JavaScript embedded in my XHTML document [2], I cant
> validate.
>
> What's going on - why is this?
Encapsulate your embedded javascript with
<![CDATA[ /*javascript goes here*/ ]]> tags, and it should validate.
<script type="text/javascript">
<![CDATA[
]]>
</script>
The reason it is not validating is because all those < and & characters
have special meaning in XML (and by extension, XHTML).
Hope this helps,
--
Burhan Khalid
thelist[at]meidomus[dot]com
http://www.meidomus.com
More information about the thelist
mailing list