Page 68 - Trackpad_V5_Book 8
P. 68

INTERNAL JAVASCRIPT

            When JavaScript code is written within the HTML web page then 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 HTML5 document. The syntax to add internal JavaScript is:

            <HEAD>
            <SCRIPT>

            JavaScript code
            .....

            </SCRIPT>
            <HEAD>
            OR

            <BODY>
            <SCRIPT>
            JavaScript code
            .....

            </SCRIPT>
            </BODY>

            EXTERNAL JAVASCRIPT

            JavaScript code can be written in a file and saved with the .js extension and this file can then be
            linked inside the <head> and </head> tags of the HTML document in which we 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.







             66   Pro (Ver. 5.0)-VIII
   63   64   65   66   67   68   69   70   71   72   73