JavaScript Script Tag || Use of Script Tag

JavaScript Script Tag


Script tag is used to tell the browser about beginning and ending points of a script inside an html document. JavaScript code can be placed inside the <body> and <head> sections of the html.


JavaScript code

Where, <script> is the point from where JavaScript code will starts </script> is the point from where JavaScript code will ends.
In the following example, a JavaScript's Script tag is created and its type attribute is set to text/JavaScript. In new browsers, there are no requirements of type, but in older documents, we have to set type attribute.

Suppose we want to write "hello students in js tutorial"

document.write and one string will be passed within a double quotes "hello students in js tutorial" when we open this script.html file in browsers, we will get output as hello students in js tutorial.


document.write("Welcome Students in JS Tutorial");

Welcome Students in JS Tutorial

<script language="javascript" type="text/javascript">

Script tag Attributes
Script tag can be incorporate with following attributes:

For Example:
language(this is deprecated)
* type(this is no longer required on new browsers)
* src(which is used URL specification of an external JS file)

Best WordPress Hosting


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price

Leave a Reply

    Waiting for your comments