Chapter 7. The Browser Environment

You know that JavaScript programs don't run on their own; they need a host environment. Pretty much everything discussed so far in this book was related to core ECMAScript/JavaScript and can be used in many different host environments. Now let's shift our focus to the browser, as this is the most popular and natural host environment for JavaScript programs. In this chapter, you will learn about:

  • The BOM (Browser Object Model)

  • The DOM (Document Object Model)

  • Listening to browser events

  • The XMLHttpRequest object

Including JavaScript in an HTML Page

In order to include JavaScript in an HTML page, you need to use the <script> tag:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ""> ...

Get Object-Oriented JavaScript now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.