Chapter 10. The window Object

The JavaScript language is based upon a standard called ECMAScript, and you can find ECMAScript used in a variety of applications and technologies. Flash has its own ECMAScript version called ActionScript, which is similar to JavaScript.

ECMAScript is most widely used, however, in web browsers, and chances are pretty good that you purchased this book and DVD to learn how to use JavaScript this way. Your wait is over (kind of).

The web browser is a JavaScript developer's platform, and every platform has what's called an Application Programming Interface, or API. An API is a set of objects and data types that allow a developer to interact with a particular platform. The web browser has two main APIs: the Browser Object Model (BOM) and the Document Object Model (DOM).

The BOM is an API to program certain aspects of the browser. It enables you to determine what web browser a user is currently using, to open and resize windows, and to navigate to a different page or website. Its primary focus is the browser window.

The DOM is another API that allows you to manipulate the HTML page loaded into the browser. You can find, add, and remove elements within the HTML document, change their appearance, and completely relocate them to different parts of the screen. The DOM's focus is the HTML document.

This lesson introduces you to the main object in the BOM: the window object. This object represents the browser window that contains the HTML page, and it allows you to ...

Get JavaScript® 24-Hour Trainer 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.