JavaScript and HTML (JNNC Technologies)


The introduction of JavaScript into web pages immediately ran into the Web’s main language, HTML. As the component of its original work on JavaScript, Netscape tried to find out how to make JavaScript coexist in HTML pages without making any break on those pages which is rendering in other browsers. Through trial and error along with controversy, several decisions were finally made and agreed upon to bring universal scripting support for the Web. Most of the work done in these early days of the Web has endured and become official in the HTML specification. In this chapter you are going to relate the JavaScript language with HTML.

Use of <SCRIPT> Element

The primary technique of inserting JavaScript into any HTML page is through the <script> element. This <script> element was created by Netscape and first implemented in the browser – Netscape Navigator version 2. Then it was later added to the formal HTML specification.
Six attributes are provided by the <script> el
ement. These are:

AttributeDescription
asyncwhich indicates that the script ought to begin downloading immediately.
charsetset the character set of the code particularize using the src attribute.
deferwhich indicates that the execution of the script can safely be deferred until after the document’s content has been fully parsed and displayed.
languagewhich indicates that the scripting language being used by the code.
srcwhich indicates that an external file that holds the code to be executed.
typeis used to replace language; indicates the content type (also called MIME type) of the scripting language being used.

0 Comments

'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })();