Page 43 - trackpad v5.1 class 8 flipbook
P. 43

CREATING A WEB PAGE WITH INTERNAL JAVASCRIPT


                 Similar  to  HTML5 web pages,  we can use  any  text  editor  like  Notepad, Visual  Studio Code,
                 Sublime Text, etc. to create JavaScript programs. After typing the JavaScript code, any web
                 browser like Google Chrome, Firefox, Microsoft Edge, etc. can be used to view the web page.
                 Let us create a web page using internal JavaScript.

                 Follow the given steps to create JavaScript program:


                 Step  1    Type <SCRIPT TYPE="text/javascript" > between the <HEAD> and </HEAD> tags to use
                          JavaScript.

                 Step  2    Use the alert( ) method to display an alert box that contains some specified message
                          and OK button.


                 <HTML>

                 <HEAD>

                 <TITLE> My First JavaScript </TITLE>

                 <SCRIPT TYPE="text/javascript">
                 alert("Hello World!");

                 </SCRIPT>

                 </HEAD>

                 <BODY>

                 This message box is displayed using JavaScript.

                 </BODY>

                 </HTML>




















                 The web browser displays the alert message ‘Hello World’.
                 Step  3     Click on the OK button in the message box.






                                                                                      Dynamic Web Pages in HTML5  41
   38   39   40   41   42   43   44   45   46   47   48