DOM Level 0 - Example

This section provides a tutorial example of DOM Level 0 objects and attributes that are supported in Netscape 3 and IE 3.

DOM Level 0 - No formal specifications published: A collection of HTML document functionalities offered by Netscape Navigator version 3.0 and Microsoft Internet Explorer version 3.0.

Here is a tutorial example of using DOM Level 0 objects and properties:

<!-- DOM_Level_0_Example.html
   Copyright (c) 2013 by Dr. Herong Yang,
<title>DOM Level 0 Example</title>
<script type="text/javascript">
var colorID = 0;
function changeColor() {
   if (colorID == 0 )
      document.bgColor = "#ff8888";
   else if (colorID == 1 )
      document.bgColor = "#88ff88";
   else if (colorID == 2 )
      document.bgColor = "#8888ff";
   else if (colorID == 3 )
      document.bgColor = "#888888";
   document.forms[0].elements[0].value = document.bgColor;
   colorID = (colorID+1)%4;
<script type="text/javascript">
   document.writeln("\"documnet\" attribute initial values:");
   document.writeln("   alinkColor = "+document.alinkColor);
   document.writeln("   background = "+document.background);
   document.writeln("   bgColor = "+document.bgColor);
   document.writeln("   fgColor = "+document.fgColor);
   document.writeln("   linkColor = "+document.linkColor);
   document.writeln("   vlinkColor = "+document.vlinkColor);
  Current document.bgColor: 
  <input type="text" name="bgcolor" value="#ffffff"><br/>
  <input type="button" value="Click to change background color"

We should test this JavaScript in Netscape Navigator version 3.0 or Microsoft Internet Explorer (IE) version 3.0. But DOM Level 0 is still supported by IE version 6. Here is how this JavaScript page will look like on IE 6:
DOM Level 0 Example

Table of Contents

 About This Book

 Introduction to JavaScript

 ECMAScript Language Specification and JavaScript Dialects

 Data Types, Variables and Expressions

 Flow Control Statements

 Creating, Accessing, and Manipulating Arrays

 Defining and Calling Functions

 Web Browser Supporting JavaScript

 Server-Side and Client-Side Web Scripting

 Introduction to Objects

 Defining Your Own Object Types

 Inheritance of Properties and Methods through the Prototype Object Chain

 'jrunscript' - JavaScript Shell Command from JDK

 Using Functions as "Function" Objects

 Introduction to Built-in Object Types

W3C's Document Object Model (DOM) Specifications

 Overview of DOM Specifications

DOM Level 0 - Example

 DOM Level 1 - Example

 DOM Level 2 - Example

 DOM Level 3 - Example

 DOM Level Test - document.implementation.hasFeature

 Inheritance vs. Flattened Views of the API

 A Web Document as A Tree of Different Interfaces

 A Web Document as A Tree of Nodes

 Dump Document in a New Window - JavaScript Source

 Dump Document in a New Window - Firefox 2.0 Result

 Dump Document in a New Window - IE 6.0 Result


 PDF Printing Version