<script> Element

To use JavaScript in a web page, the <script> element tags are used.

 

Strictly speaking, the TYPE attribute should be set to 'application/javascript', but since that doesn't work in IE it is more common to either find 'text/javascript' or nothing.

 

You may also sometimes find // <![CDATA[ just after the opening <script> tag and its associated // ]]> just before the closing </script > tag. These commented out lines inform XHTML supporting browsers that the content of the script is character data and should not be interpreted as XHTML markup, and are generally not bothered with but is good to know just in case.

 

Save & refresh browser:

Javascript goes here!

Leave a Reply