HTML and CSS Reference
In-Depth Information
The specific usage of this property and method are beside the point at this stage; what
is important is the conceptual difference between properties and methods and the know-
ledge that JavaScript can access settings and behavior in the web browser beyond just
the HTML elements on the page.
Logging to the console
Chapter 1 also mentioned the web developer tools available to major web browsers and
the code console.log("message") . Let's look at these two topics closer. Among
the web developer tools in each browser, there will be a means to access a JavaScript
console where messages from JavaScript can be logged. In the major web browsers,
these are found as shown here:
Chrome : Select View Developer JavaScript Console.
Firefox : I recommend using the Console tab in Firebug.
Internet Explorer (8 and above) : There is Script tab in the Internet Explorer
Developer Tools, accessible by selecting Tools Developer Tools.
Opera : Select View Developer Tools Error Console. Opera also has a
toggle in Opera Dragonfly for showing and hiding a console.
Safari : Select Develop Show Error Console.
If you modify your template script to log a message, you should see it appear in the
JavaScript console when loading the page. Figure 7-1 shows an example in Safari of
running the following code:
function init() {
// log a message to the
JavaScript console
window.onload = init;
Search WWH ::

Custom Search