spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / programming / javascript / diaries / 7

[next]

Web Project Manager
Aquent
US-PA-Collegeville

Justtechjobs.com Post A Job | Post A Resume
Developer News
Mandrake Linux Founder Back, Virtually
Amazon: We're a Technology Company
Sun Expands MySQL With Closed Source

The JavaScript Diaries: Part 7

  1. Introduction
  2. Data Types & Variables
  3. Operators
  4. Functions
  5. Conditional Statements and Loops
  6. Objects
  7. Browser-Based Objects
  8. Window Methods
  9. Window Event Handlers
  10. Navigator, Screen, History and Location Objects
  11. Arrays: Part 1 - Introduction
  12. Arrays: Part 2 - Multiple Array Types
  13. Arrays: Part 3 - Array Properties and Methods
  14. The Math Object
  15. The Date Object

By 

In our last installment we began our study of objects by looking at how to create custom-made objects using the Object() constructor. We will continue that study by taking a look at browser-based objects. While there are several browser-specific objects, we will concentrate on the more common objects that are compatible with most browsers.

Review

Before we begin, let's have a short review. JavaScript is an object-based scripting language. This means that the JavaScript interpreter sees the existing data structure grouped together as objects rather than a bunch of scattered, random items. An object, its related properties and methods are grouped together in a single package.

An object has properties, which are components or parts of the object. The properties of an object are accessed through the use of a dot operator, for example, object.property.

An object can also have methods. A method does something to the object or with the object. A method is also accessed using the dot operator, for example, object.method().

If you need to, you can go back and review the section on objects.

One thing to keep in mind is that all objects are really nothing more than data containers. Other containers include strings, variables, and functions.

JavaScript's Browser-Based Objects

JavaScript has several browser-based objects. These allow us to interact with the browser and Web page itself. All of the browser-based objects are placed in a hierarchy, beginning with the window object.

These browser-based objects are categorized under two sub-headings: Browser Object Model (BOM) and Document Object Model (DOM). An object model is nothing more than a description of the structure of the objects within a system. It includes their identity and relationship to other objects, attributes and operations.

The Document Object Model (a.k.a. "the DOM")

The Browser Model Object (BOM)
The Browser Object Model (BOM)

The Document Object Model is the category most people refer to when speaking of browser-based objects and is a W3C standard. According to the W3C Web site, "The Document Object Model is a platform- and language-neutral interface that will allow programs and scripts to dynamically access and update the content, structure and style of documents." In plain English, the DOM describes the relationship of the HTML elements within the document to the document object itself. By using it when we're writing JavaScript code, we can gain access to all of the HTML elements on the Web page, allowing us to add, change, or delete elements, attributes and content. The DOM is specifically related to the document itself. It's contained inside the Browser Object Model. It does not include the browser and all things related to it, e.g., the window. We'll discuss the DOM in depth in later sessions.

The Browser Object Model (a.k.a. "the BOM")

For some reason, the Browser Object Model is generally not referred to by its proper name. More often, it's usually wrapped up with the DOM. In actuality, the DOM, which relates to all things pertaining to the document, resides within the BOM.

The BOM, as you may have guessed, covers objects which relate to the browser. At the top of the BOM hierarchy is the window object. Below that comes the navigator, screen, history, location, and document objects (in no particular order). The document object is the top level of the DOM hierarchy. In the diagram at the right, each object below the window is of equal status. They all relate directly to the window object.

Let's look at each of these objects separately and see how they work. We'll begin with the window object.

home / programming / javascript / diaries / 7

[next]

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Whitepapers and eBooks

Symantec Whitepaper: Converging System and Data Protection for Complete Disaster Recovery
Intel Whitepaper: Comparing Two- and Four-Socket Platforms for Server Virtualization
IBM Solutions Brief: Go Green With IBM System xTM And Intel
HP eBook: Simplifying SQL Server Management
IBM Contest: Are You the Next Superstar? Join the "Search for the XML Superstar" Contest to Find Out
Intel PDF: Quad-Core Impacts More Than the Data Center
Intel PDF: Virtualization Delivers Data Center Efficiency
Go Parallel Article: PDC 2008 in Review
Avaya Article: Communication-Enabled Mashups: Empowering Both Business Owners and IT
Intel Whitepaper: Building a Real-World Model to Assess Virtualization Platforms
PDF: Intel Centrino Duo Processor Technology with Intel Core2 Duo Processor
Microsoft Article: Build and Run Virtual Machines with Hyper-V Server 2008
  Go Parallel Article: Q&A with a TBB Junkie
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
IBM eBook: The Pros and Cons of Outsourcing
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Symantec Whitepaper: Comprehensive Backup and Recovery of VMware Virtual Infrastructure
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Fixing MySQL Replication · Firewall Guide: First Steps to Securing the Enterprise · VoxOx Tames the Tumultuous Communications Tangle

Created: July 22, 2005

URL: