Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 67 - 2612_Digimind
P. 67

    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.

                     <!DOCTYPE HTML>

                     <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  65

| 62 63 64 65 66 67 68 69 70 71 72 |