Go to: Aardvark download page.

JavaScript

If you take a look at the source code of a page containing a script you'll find something like this:

<script type="text/javascript" name="myFunkyScript">
<!--
***some code here***
// -->
</script>

  • The first tag "<script type="text/javascript">" tells the browser what type of script it should expect.
  • The strange line looking like this "<!— "s old browsers, that can't handle JS, to skip the code.
  • Your script goes here!
  • Line 4 uses the symbol "// -->" to tell old browser to "start looking gain".
  • "</script>" means that the script ends here.

The reason we use the comment symbols to keep old browsers out is that some browsers render the text between the <script> tags on screen, and we don't want that!

If you have written a state of the art script that only works in some of the new browsers you can specify, in the script tag, what JS version the script is using. Like this:

<script language="javascript1.2" name="myFunkyScript">

This will make browsers that run JavaScript 1.1 (or earlier) skip your code.

Back to tutorial index <<