HTML5 Tutorial





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
HTML5 TOPIC
Introduction
Basic Root Elements
Sections
Grouping Elements
Manipulating Text
Editing Tags
Embed Tags
Table Elements
Form Elements
Interactive Elements
Miscellaneous Elements
Deprecated Tags
Input Type Attributes
Form Attributes
Input Attributes
Global Attributes
Event Attributes
Ask Your Doubts
Feedback
 




Script Element

Syntax

<Script>


Explanation

Script element is used to write a script for e.g. Javascript.
<script type="text/javascript">
document.write("Text")
</script>
Element Specific attributes supported by this element are:
AttributeValueDescription
asyncasync The external script will be executed on its own. But need to mention the source.
deferdefer Script will be executed, when page has completed the parsing work.
typeMIME_type Denotes the MIME type of the script. But need to mention the source.
charsetcharacter_set Illustrates the character encoding utilized in external script file.
srcURL Refers to the source of the script file.

"Async" attribute has been newly launched in HTML5.

Example Code:

Result:  

  • To validate the "async and type" attributes, the "src" attribute must be used compulsorily.
  • Do not add any contents inside <script>, in case "src" attribute is used.
It is available in the previous versions of HTML.
It supports both Global Attributes and Event Attributes in HTML5.

Limitations:

It is applicable to all major browsers.





A Note
This tutorial depicts about HTML5. Any person who has suggestions or feedbacks related to this tutorial, can approach us. We do welcome your valuable opinions. Contents mentioned in this tutorial are "Copyright".
Other Links

web hosting