JavaScript


It’s relatively unknown HTML tag that works like alternative description when your browser doesn’t support scripting or when JavaScript is disabled. While this one is not so relevant for modern desktop browsers, it becomes relevant again when creating applications for mobile browsers.

Example of use:

<script type=”text/javascript”>
document.write(“Hello World!”)
</script>
<noscript>Your browser does not support JavaScript!</noscript>

If you are including scripts in your ASP.NET pages, don’t forget that you CANNOT put script tag like this

<script type=”text/javascript” src=”somescript.js” />

because browser will not recognise this as correct markup and probably all your stuff after this tag will not be correctly put to the DOM model.

You need to use this instead:

<script type=”text/javascript” src=”somescript.js”></script>

Is someone told me that they’re fully XHTML compatible? :)