Chapter 6. Browser and Document Objects

IN THIS CHAPTER

  • What client-side scripts do

  • What happens when a document loads

  • How the browser creates objects

  • How scripts refer to objects

  • What distinguishes one object from another

In this chapter, you'll see several practical applications of JavaScript and begin to see how a JavaScript-enabled browser turns familiar HTML elements into objects that your scripts control. This tutorial teaches concepts and terminology that apply to modern browsers, with special focus on standards compatibility to equip you to work with today's and tomorrow's browsers. You should study this tutorial in conjunction with any of the following browsers: Internet Explorer 5 or later (Windows or Macintosh), any Mozilla-based browser (Firefox, Netscape 7 or later, or Camino), Apple Safari, or Opera 7 or later.

Scripts Run the Show

If you have authored web pages with HTML, you are familiar with how HTML tags influence the way content is rendered on a page when viewed in the browser. As the page loads, the browser recognizes angle-bracketed tags as formatting instructions. Instructions are read from the top of the document downward, and elements defined in the HTML document appear on-screen in the same order in which they appear in the document's source code. As an author, you do a little work one time and up front—adding the tags to text content—and the browser does a lot more work every time a visitor loads the page into a browser.

Assume for a moment that one of the elements ...

Get JavaScript® Bible, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.