Copyright © tutorialspoint.com

HTML <script> tag



Advertisements

Function:

The HTML <style> tag is used for declaring a script (such as JavaScript) within your HTML document.

Difference between HTML and XHTML:

NONE

Example:

<script type="text/javascript">
document.write("Hello Javascript!")
</script>

This will produce following result:

Hello Javascript!

For more detail on <script> tag please check HTML Scripts chapter.

Online Practice:

To Become more comfortable - Do Online Practice

Attributes:

AttributeValueDescription
typetext/javascript
application/ecmascript
application/javascript
text/vbscript
Specifies the scripting language as a content-type (MIME type).
charsetcharsetDefines the character encoding that the script uses.
deferdeferDeclares that the script will not generate any content. Therefore, the browser/user agent can continue parsing and rendering the rest of the page.
languagejavascript
livescript
vbscript
other
Deprecated - Specifies the scripting language. Don't use this attribute use the type attribute instead.
srcURLSpecifies a URI/URL of an external script.

Standard Attributes:

AttributeDescription
xml:spaceSets the language code.

Copyright © tutorialspoint.com