JavaScript structure

You should now have a working Web page and working CSS.  If yours is broken it would be best to go back and do the HTML and CSS again from the start (delete what you have done so far).  The code you have created for this introduction does not have to be perfect though so if you cannot be bothered to start again you can download a correct copy of the pages by clicking here. Download them and extract the folder which contains the two pages and the style sheet ready for the JavaScript.  It is better to use yours but just in case you lost or broke it this one is available.  You could also use this version to compare to yours as a check.  They may not be identical but it should be close.

To add JavaScript into your first page open index.html in in your text editor and add this code just under the link line which points to the stylesheet:

<script type="text/javascript">


The browser will see the first script tag and realise there is some JavaScript coming.  All modern browsers understand JavaScript.

The simplest JavaScript you can add is probably this (paste it inside the script tags on the blank line):


Save the page and load it in your browser.  It should pop up a message saying hello.  Feel free to make it say something else instead!