Let's start with a simple example. First click here to see what it does.

If we look at the source of that page, we would see this:


<html> 
<head> 
<title> JavaScript Example 1
</title> 
</head>
<body> 
This is the first line of text on the page. < /br>
<script type="text/javascript"> 
	alert("hello!");
</script> 
This is the second line of text on the page.
</body> 
</html> 

The file is a regular HTML file, with a JavaScript program stuck in the middle of it.

First notice how the JavaScript is inserted -- using the HTML tag pair <script> and </script>

Now let's look at what the script does. The script consists of one line only, which says

	alert("hello!");
alert is a function that directs the browser to pop up a little window with a message. The message displayed in the window will be whatever message you included in the parentheses.

In general, you can say

	alert(" your message goes here ");
and whatever message you specify will be displayed.

Notice that the words of the message are contained in quotes, but that the quotes will not appear on the screen when the alert box pops up.

Watch out for proper punctuation. You must use open and close quotes around the message.


Exercise 1:

Write an HTML page that contains a JavaScript alert to say:   Thanks for visiting my page