The alert box is an excellent debugging tool that you can use when you are having a problem with getting your code to work. So far our code is simple and not really needing such a tool. But as your scripts get more complex, you will welcome a method of trouble shooting your code to see how the variables are set or what sequence the code is going though. So remember the alert box and learn how to use it in such situations. It is invaluable.
Lets look at the code that was used to call the alert box in our demonstration above.
Look at the value that the href attribute is set equal to. Also note that our example contains both single and double quotes as we talked about earlier. Doing this prevents me from having a dead link and also reminds me that I need to develop the page. This is a example of using an event handler to call a JavaScript function. Events are actions that take place in a document and are often caused by something that the user did.