HTML and CSS Reference
In-Depth Information
Figure 7-1. Safari's error console showing logged JavaScript output.
Note Another option for logging JavaScript output is Firebug Lite, a version of Fire-
bug that can be used with Internet Explorer, Firefox, Opera, Safari, and Chrome. Down-
load it here: http://getfirebug.com/firebuglite .
Although it is all well and good to log messages to the console, the real power of the
console comes from logging parts of the DOM and inspecting the value and existence of
objects, properties, and methods. For example, try changing the console message in the
prior code snippet to the following, and reload the page:
console.log(window);
// log the window object to the
JavaScript console.
This will produce (depending on the JavaScript console) a representation of the win-
dow object as a collapsible list of properties and methods, as shown in Figure 7-2 .
 
Search WWH ::




Custom Search