Book Image

Object-Oriented JavaScript

Book Image

Object-Oriented JavaScript

Overview of this book

Table of Contents (18 chapters)
Object-Oriented JavaScript
Credits
About the Author
About the Reviewers
Preface
Built-in Functions
Regular Expressions
Index

BOM


The BOM (Browser Object Model) is a collection of objects that give you access to the browser and the computer screen. These objects are accessible through the global objects window and window.screen.

The window Object Revisited

As you know already, in JavaScript there's a global object provided by every host environment. In the browser environment, this is the window object. All global variables become properties of the window object.

>>> window.somevar = 1;

1

>>> somevar

1

Also, all of the core JavaScript functions (discussed in Chapter 2) are methods of the window object.

>>> parseInt('123a456')

123

>>> window.parseInt('123a456')

123

In addition to being the global object, the window object also serves a second purpose and that is to provide data about the browser environment. There's a window object for every frame, iframe, popup, or browser tab.

Let's see some of the browser-related properties of the window object. Again...