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

The web browser displays the web page.



















                            CREATING A WEB PAGE WITH EXTERNAL JAVASCRIPT

                  To use external JavaScript, follow the given steps:

                  Step  1    Open the Notepad and type the following line:

                           alert("Hello World");

                  Step  2    Save the file with .js extension. In our case, we have saved the file with the name external.
                           js.

                  Step  3    Open another Notepad and type the following code:
                  <HTML>

                  <HEAD>

                  <TITLE> My First JavaScript </TITLE>
                  <SCRIPT TYPE="text/javascript" SRC="external.js">

                  </SCRIPT>

                  </HEAD>
                  <BODY> This message box is displayed using external JavaScript.

                  </BODY>

                  </HTML>
                  Step  4     Save the file with .html extension and open the web page in web browser. You will get the

                           same output as the previous web page.





















                   46   Computer Science (V5.0)-VIII
   43   44   45   46   47   48   49   50   51   52   53