The World Wide Web (WWW) was introduced in the early 1990s. It was followed by the development of HTML which was used to create web pages. As HTML is only used to describe the content in a web page, developers were only able to create static web pages.
The first scripting language was introduced by Brendan Eich, a member of Netscape 2 group, in early 1996. It was introduced to provide dynamism and interactivity with the web pages. Its codename was Mocha, also called as LiveWire and even later called as LiveScript as the browser could interpret the code on the fly rather than compiling the code and then execute it.
The <script> tags can be either included in the head section of the web page or in the body section of the web page. It is valid to specify multiple <script> blocks in a single web page. When there are multiple scripts, they are executed from top to bottom.
- Makes HTML file cleaner and easy to understand.
The syntax for line comment is as shown below:
// This is a line comment. This is used for writing single line comments.
The syntax for block comment is as shown below:
This is block comment.
This is used to write multi-line comments.
Instead of not doing anything, it will be more informative if the browser displays some sort of warning or error message. This can be achieved by using the <noscript> tag provided by HTML. Below example demonstrates the use of <noscript> tag:
Internet Explorer 4.0 or higher is required to view the web page. Upgrade your browser and try again.