Page 42 - Trackpad_V2.1_class8
P. 42
INTERNAL JAVASCRIPT
When JavaScript code is written within the HTML web page, it is called internal JavaScript.
We use the <SCRIPT> and </SCRIPT> tags to place the JavaScript codes either in the <HEAD> or
<BODY> tag of the HTML document. The syntax to add internal JavaScript is:
<HEAD>
<SCRIPT>
JavaScript code
.....
</SCRIPT>
HTML provides the structural skeleton
</HEAD> of a webpage, similar to how natural
OR formations like mountains and valleys
define the landscape of an environment.
<BODY>
<SCRIPT>
JavaScript code
.....
</SCRIPT>
</BODY>
EXTERNAL JAVASCRIPT
JavaScript code can be written in a file and saved with the .js extension. This file can then be
linked inside the <HEAD> and </HEAD> tags of the HTML document where you want to add this
code. The SRC attribute of the <SCRIPT> tag allows to give path of the JavaScript file. The syntax
to add external JavaScript is:
<HEAD>
<SCRIPT TYPE="text/javascript" SRC="D:\first.js">
</SCRIPT>
</HEAD>
Note that there are many other scripting languages, hence, it is recommended to use the TYPE
attribute with the <SCRIPT> tag and set its
value to text/javascript to specify that
scripting language we are using. First web browser to support javascript
Tick ( ) if you know this.
▶ JavaScript is a client-side scripting language used for enhancing users’ interaction with the
web page by making web pages dynamic.
▶ JavaScript is a case-sensitive and interpreted language.
40 Trackpad (V2.1)-VIII

