Page 133 - Computer Software Application TP - Volume 1
P. 133

COMPUTER SOFTWARE APPLICATION - CITS


                                           Module 3 : Introduction to JAVA Script


           EXERCISE 37 : Using  the JAVA Script Syntax


            Objectives

           At the end of this exercise you shall be able to
           •  create javascriptcode as in line style
           •  use external javascript files in HTML.


           Requirements

           Tools/Materials
           •  Desktop / Laptop with latest configuration
           •   Text editor
           •  Web browser



           Procedure

           TASK 1: Inline JavaScript

              1  Open the text editor
              2  Write the following codes
                <html >
                <head>
                <meta charset=”UTF-8”>
                <meta name=”viewport” content=”width=device-width, initial-scale=1.0”>
                <title>JavaScript Example</title>
                </head>
                <body>
                <script>
                // JavaScript code goes here
                console.log(“Hello, world!”);
                </script>
                </body>
                </html>
              3  Save the program as a .html file
              4  Open the html file with a web browser
              5  Go to the browsers console tab and verify the output.




















                                                           118
   128   129   130   131   132   133   134   135   136   137   138