Home | Community | Developer's Paradise | Jobs
User Groups | Site Tools | Site Information | Search

Book/Chapter 7/

About

 

Part I - HTML and Scripting
Overview of HTML and CSS
Fundamentals of HTML Scripting
Dynamic HTML Event Model
Programming the Browser Window
Window and Frame Management

 
Part II - Document Structure
The HTML Document
Programming Element Collections
Scripts and Elements
Scripting Individual Elements
Forms and Intrinsic Controls
 

Part III - Dynamic Styles and Animation
Dynamic Styles
Dynamic Positioning

 

Part IV - Dynamic Content
Dynamic Content
User Selection and Editing
Data Binding with HTML

 


Inside Dynamic HTML

Inside Dynamic HTML Book Cover

Order Now
from
Amazon.com

Inside Dynamic HTML
Microsoft Programmers Series

The Dynamic HTML object model represents the document's structure through a set of collections exposed on the document object. These collections provide access to all HTML elements contained within the document. Understanding how these collections relate to the HTML source code and how to access these collections is the first step to programming the HTML document. This chapter shows you how to manipulate the document element collections as well as how Internet Explorer 4.0 parses the document.

Consider the following short HTML document:

  <HTML>
     <HEAD>
        <TITLE>Document Structure</TITLE>
     </HEAD>
     <BODY>
        <H1>Overview</H1>
        <P>Examining an HTML document</P>
     </BODY>
  </HTML>

The object model provides a way to access the HTML, Head, Title, Body, H1, and Paragraph elements and thereby modify their attributes. The markup, like all aspects of the document, is accessed using the document object introduced in Chapter 6, "The HTML Document." The document object exposes an all collection that represents every element in the document and several filtered collections that represent a subset of the document's elements. For example, the forms collection contains only the Form elements. In addition, developers can create their own custom collections of document elements.

The ability to access any element in the document is a key innovation in Dynamic HTML. Until Dynamic HTML, scripts could manipulate only the set of elements deemed interesting by vendors developing the browser. Now Web developers have complete control over the page and can decide for themselves what is interesting. They can filter the all collection and manipulate any set of elements as a group, removing all limitations and providing universal access to the document.

The following topics are covered in this chapter:

  • Using the Collections

    Every collection in Dynamic HTML shares the same set of operations. This section shows you how to access the elements within each collection, as well as how to create custom collections of elements. Because every collection in the HTML object model follows the same rules, this section provides a solid basis for manipulating and using the collections. The rest of Part II builds on this information by showing you how to manipulate the individual elements within the collections.

  • The HTML Structure and Collections

    This section describes how the HTML document is parsed and exposed by the underlying collections. This discussion also covers how invalid HTML documents are parsed and surfaced in the object model, which is important to understand when you are scripting generic pages in which control over the document's structure is not available.

© 1997-98 InsideDHTML.com, LLC. All rights reserved.