Yeah, sounds like you’re using XHTML. In that case you need to declare your JS as character data (CDATA), otherwise the parser thinks it’s still HTML.
… your code here …
The best, however, is to have unobtrusive JS
in a separate file which you just reference in the head using the