AlfieWebDevTips Homefor new and experienced developers
[Home Home] [Web Development Web Development ] [Code Generators Code Generators ] [Resources Resources ] [Contact Us Contact ] |WebDevTips Privacy Privacy |
Print This Page

You are here : Home - Web Development - Javascript - Getting Started - The Script Tag

The Script Tag



There are several ways of implementing javascript onto your webpage and which one you use will vary according to your needs. Most scripts use the following method.

Javascripts are enclosed between the <script> </script> tags as below.


<script language="JavaScript" type="text/javascript"> 
<!-- 
Your Code Goes Here
// -->
 
</script> 
<noscript></noscript>

The language defines the version of Javascript and can be one of the following.

  • JavaScript
  • JavaScript1.1
  • JavaScript1.2

Your code is written between the comment tags. This prevents your code from being displayed in non javascript enabled browsers.

The <noscript></noscript> tags are used to put a description of what the script does or to inform the visitor that javascript is required.

Example :

<noscript> This page contains a script that requires javascript.</noscript>

It is a good idea to get into the habit of using the <noscript></noscript> tags at this stage as it is important to let non javascript visitors know what's going on.

Depending on the nature of the script the above code can be placed between the <head> </head> tags or between the <body> </body> tags.

Next we'll take a look at external scripts.




16 Nov 2003




Google
 

[back to top of page]   

[labelled with icra -  - this link will open in a new window] [RSS Content]

[Copyright © WebDevTips]