Learn html - html tutorial -
script tag - html examples - html programs
<script> tag belongs to
Metadata content, Flow content and Phrasing content. Syntax for <script> tag:
Differences between HTML 4.0.1 and HTML 5 for <script> tag in HTML:
The "type" attribute is required.
The "async" attribute not supported.
"xml:space" is supported.
The "type" attribute is optional.
The "async" attribute is new to HTML5.
"xml:space" is not supported.
Sample Coding for <script> tag:
Tryit <!DOCTYPE html>
<title>Wikitechy HTML script Tag </title>
<p id="para"> </p>
document.getElementById("para").innerHTML = "Hello Wikitechy!";
Code Explanation for <script> tag:
<p> tag id value has been defined as “para”.
<script> tag is used to embed the executable script.
The text Hello Wikitechy! will be included inside <p> tag which has the id as para. Output for <script> tag:
The text “Hello Wikitechy!” has been included inside <p> tag by using <script> tag.
Attributes of <script> tag:
Defines that the script is executed only for external scripts.
Defines the character encoding used in an external script file.
Defines that the script is executed though the page has been finished parsing.
Defines the URL of an external script file.
Defines the media type of the script.
Defines whether whitespace in code have been preserved.
Browser Support for <script> tag in HTML:
Tips and Notes
"src" attribute is present, the <script> element must be empty. There are many ways an external script should be executed:
async="async": The script can be executed while the page continues the parsing.
defer="defer": The script is executed when the page has finished parsing. If
neither async or defer is present: The script is fetched and executed immediately, before the browser continues parsing the page.
comments powered by Disqus.
Related Searches to <script> tag in html
script tag src
html script example
html script tag location
which tag is equivalent to script in html
html tutorials html editor html code html form html tutorial html color html color codes html table html img html5 html code for website html and css html programs html website free html editor html5 tutorial wysiwyg html editor html tutorial pdf html converter php tutorial html example html tutorial css tutorial html css html tags html basics code html html online html mailto html lang html tags list