JavaScript doesn't have to be validated, however, you have to make sure that most of the browsers support what function you are going to use otherwise your site might not be available to others. I prefer to make a new .js file for JavaScript because it keeps the XHTML file tidier, and I find it easier to edit.Most Markup validators can validate XHTML files. Try the W3C Markup Validation Service. There is also a CSS Validation Service. Another tool is Unicorn, a universal conformance checker, by W3C. It can check (X)HTML and CSS at the same time. Other tools by W3C like the Link Checker are also useful.