Page 62 - Chinmaya_C8_flipbook
P. 62
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. are 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 virtual alert box that contains some specified message
and an 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>
Step 3 Save the above code with .html and open this file in any web browser.
The web browser displays the alert message ‘Hello World’.
60 Premium Edition-VIII

