Script Tag

Script  tag are used for define JavaScript functions required for the page. It may be inside thetag or you can use this tag any where on html page.In html we use different tags and every tag has its different functionality. Like all html tags script tag has its own functionality.


<!DOCTYPE html>

<title>HTML script Tag</title>

<script type = “text/JavaScript”>
document.write(“You’re visiting codingknack!”)



You’re visiting codingknack!

The HTML <script> tag also supports the following additional attributes −


async sync Specifies that the script is executed asynchronously.
charset charset Defines the character encoding that the script uses.
defer defer Declares that the script will not generate any content. Therefore, the browser/user agent can continue parsing and rendering the rest of the page.
src URL Specifies a URI/URL of an external script.
type text/JavaScript application/ecmascript application/JavaScript text/vbscript Specifies the scripting language as a content-type (MIME type).
xml:space preserve Deprecated – Whether the whitespace in code should be preserved

Script tag support specific attributes and supports all the global attributes.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close Menu