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

Inside Technique : W3C DOM Table of Contents
By Scott Isaacs

In our last article we explained two techniques for automatically creating a table of contents - one focusing only on Internet Explorer's 4.0 DHTML model and another for Internet Explorer 5.0 using a combination of the Internet Explorer approach and the W3C recommendation. this article, we continue with a third technique for generating a table of contents based only on the W3C DOM recommendation and the ECMA-262 (JavaScript) standard. When writing this script, we added two additional requirements - the script must run in Internet Explorer 5.0 and Netscape's Gecko M4 Developer Preview.

Rewriting the table of contents to be completely standards based proved to be a challenge. Surprisingly more of this challenge was related to complexities of the W3C recommendation rather than compatibility issues between IE5 and Netscape Gecko.

The W3C DOM focuses on exposing node objects that represent the HTML tree. Manipulating the document requires you to navigate this hierarchy of objects. On the next page we introduce you to the W3C DOM properties and methods used to implement our table of contents scripts.