Book Image

Object-Oriented JavaScript

By : Stoyan Stefanov, Stoyan STEFANOV
Book Image

Object-Oriented JavaScript

By: Stoyan Stefanov, Stoyan STEFANOV

Overview of this book

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


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;


>>> somevar


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

>>> parseInt('123a456')


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


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...