Main Page

Mozilla (all platforms)

The problem with IE/Mac’s error alerts is that it doesn’t give an accurate line number for external scripts
(the line number is typically the line in the HTML file where the script has been referenced). In extreme
cases, it may be more useful to insert the script inline for testing purposes.
Mozilla (all platforms)
Mozilla features a JavaScript console that logs not only errors, but warnings as well. To access the
JavaScript console, look under Tools
Web Development
JavaScript Console in Mozilla 1.0+ (prior
to 1.0, the JavaScript console was located under Tasks
JavaScript Console).
Just like its predecessor Netscape Navigator, Mozilla allows you to type javascript: into the address
box to open the JavaScript console instead of accessing it from the menu.
The JavaScript console reports three types of messages: errors, strict warnings, and messages. Errors are
either syntax or runtime errors (anything that stops script execution), and they are reported with the
error message, the filename, and the line number on which the error occurred (Figure 14-5). Strict warn-
ings occur when the code does something illegal, but the interpreter works around it allowing the script
to continue running (such problems include redefining a previously defined variable). Messages are
purely informational and often are a result of internal Mozilla processing, not JavaScript.
Figure 14-5
Chapter 14
17_579088 ch14.qxd 3/28/05 11:41 AM Page 416

JavaScript EditorFree JavaScript Editor     Ajax Editor