JavaScript

Before you begin I would recommend getting Firefox and getting the add on firebug to test your code. This will make debugging a lot easier. Also the open source software NotePad++ http://notepad-plus.sourceforge.net/uk/site.htm makes a great editor.
First, lets create a html page.  Create a text file and change the file extension to HTML. Then right click on the file and choose open with>Word Pad   (or Notepad ++ if you have that).
Type in the following text:

<HTML>
<HEAD>
</HEAD></BODY>
<p> Hello World </p>
<BODY>
</HTML>

Save and double click on the file.  It should have been brought up in a browser and look like a rather simple webpage.

Now, in the Header section, between <HEAD> and </HEAD> add:

<script type = text/javascript LANGUAGE= JavaScript >
function helloagain()
{
alert( Well, Hello yourself. );
}
</script>

Then change
<p> Hello World </p>
to

<p onmouseover = helloagain() > Hello World </p>

Now save and open up in a browser.  When you mouse over the text a message box should appear.

Leave a Reply

Your email address will not be published. Required fields are marked *