If you take a look at the source code of a page containing a script you'll find something like this:
***some code here***
- 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:
Back to tutorial index <<