The Web Professional's Handbook | 2 | WebReference

The Web Professional's Handbook | 2

The Web Professional's Handbook

The Web Professional's Handbook Book Cover

Chapter 6: Document Object Models

When you use JavaScript, you often want to influence certain HTML elements. This may be as simple as retrieving the contents of a form field and validating it, or it can be as complex as removing certain paragraphs from the page and inserting images in their place. However, before you can do anything with an element, you must tell the browser exactly which element you want to manipulate. You must be very explicit in giving these commands: all browsers must understand which element you mean.

It's here that the Document Object Model or DOM comes into play. Each browser that supports JavaScript has some sort of DOM: some way of providing access to HTML elements. Of course, older browsers offer only limited access to elements, while modern browsers allow you to access any part of the HTML page.

There are no less than four "Document Object Models". This chapter deals with all of them.

Excerpt Contents

  • DOM History
  • The Level 0 DOM
  • The Intermediate DOMs
  • The Level 1 DOM
  • The Level 0 DOM
  • The document Object
  • The forms Object
  • The elements Object
  • Accessing Text Fields
  • Accessing Checkboxes
  • Accessing Radiobuttons
  • Accessing Buttons
  • Accessing Selects and the Selected Option
  • Common Tasks with Forms
  • Form Validation
  • Select Box Navigation
  • Changing Options in a Select Box
  • The images Object
  • Creating Image Objects
  • Rollovers
  • The links Object
  • The Intermediate DOMs
  • Microsoft DOM
  • Netscape DOM
  • Layers as Separate Documents
  • DHTML micro-API
  • The W3C DOM
  • Walking Through the DOM Tree
  • Accessing an Element
  • Adding and Removing Nodes
  • Information About Nodes
  • Using the W3C DOM
  • Summary
  • Bookmarks

Created: March 8, 2003
Revised: March 8, 2003