Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 46 - 2611_SmartGPT Pro V(5.0) C-8
P. 46

    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,        What makes JavaScript essential for dynamic web pages?
                      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.

                           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.

                       44   Computer Science (V5.0)-VIII

| 41 42 43 44 45 46 47 48 49 50 51 |