Help Debugging JavaScript

If you're using Internet Explorer, at the lower left corner of the window you will usually see the IE icon and the word "Done." If a script error has occurred, the IE icon is covered with a yellow triangle with exclamation point. Double-clicking the triangle will display the last JavaScript error message. Next and previous buttons let you see all messages if there are more than one. The line numbers are right, but the messages themselves sometimes aren't very helpful.

Netscape Navigator does a little bit better. Typing "javascript:" (notice the trailing colon) after a page has been displayed displays a JavaScript console screen with more helpful error messages. For Navigator 7, you don't even need to do that. You can open the JavaScript console using tools --< web development.

Mozilla Firefox from http://www.mozilla.org in its current incarnation has the best support of all for debugging JavaScript. Under tools --< web development you will find not only a JavaScript console but also a DOM Inspector tool and a JavaScript debugger. I can't provide help for using the debugger, but if you are going to be writing JavaScript after this course, you should probably learn it.

Finally, you can make use of the "alert();" function in debugging your scripts. Put something like alert('Inside changephoto'); at the top of a function to determine whether the function is getting called.