Wednesday, 4 June 2014

HTML "script" tag

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!


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.

No comments:

Post a Comment