Using <script language="JavaScript" src="javascript.js" type="text/javascript"/>
is not valid (as per the W3C) for 2 reasons. The first being that the script tag is a content element and must use a </script>
to close the elements envelope. The second, if the script tag was a leaf (contentless) element, there must contain a space before the />
. Using language="JavaScript"
has been deprecated.
The only exception to this is when using XHTML, and although using the script tag as a leaf element will parse correctly in most modern browsers, it will cause the page to break in older browsers. This lack of backward compatibility is the primary reason the W3C will ONLY validate the script tag as a leaf element when used in XHTML.
To prove this point, I have provided a srcipt tag test using standard HTML and a srcipt tag test using XHTML. The official W3C validator can be found at validator.w3.org site.
Lastly, your in page script must use type="text/javascript"
to validate correctly. Again, using language="JavaScript"
has been deprecated and is not necessary.
Hope this helps. Enjoy! :)