Share this Page URL
Help

Hour 21. Finding and Handling Errors > Basic Debugging Tools - Pg. 200

Finding and Handling Errors HTML Errors 200 Last but not least, don't forget that JavaScript isn't the only language that can have errors. It's easy to accidentally create an error in an HTML document--for example, forgetting to include a closing </table> tag, or even a closing </script> tag. While writing proper HTML is beyond the scope of this book, you should be aware that sometimes improper HTML can cause errors in your JavaScript. When you experience bugs, be sure to double- check the HTML, especially the objects (such as forms or images) that your script manipulates. Tip A variety of programs are available for checking the HTML syntax of your documents. This can help you avoid errors, as well as conform to the HTML specifications. See Appendix B, "Tools for JavaScript Developers," for a list of these programs. Basic Debugging Tools If checking your script for common mistakes and obvious problems doesn't fix things, it's time to start debugging. This is the process of finding errors in a program and eliminating them. Some basic tools for debugging scripts are described in the following sections. Netscape's JavaScript Console The first thing you should do if your script doesn't work is check for error messages. In Netscape 4.5 and later, the messages are not displayed by default, but are logged to the JavaScript console. To access the console, type "javascript:" in Netscape's Location field. The console displays the last