The <script> tag

<script> includes some javascript code. <script> tags can appear anywhere in the page, but the XHTML will include them all in the header.

Because of the nature of XML, scripts will get mangled if included wiithout special markup. That is why you should surround your script with the appropriate tags.


The <script> tag has no attributes.


Let's say we want to have a script that opens a window. You would include that script like this:


Click this link to see the result.