JavaScript - The IE 4 DOM

This document object model was introduced in Version 4 of Microsoft's Internet Explorer browser. IE 5 and later versions include support for most basic W3C DOM features.

Document Properties in IE 4 DOM

The following non-standard (and non-portable) properties are defined by Internet Explorer 4 and later versions.

Sr.No Property & Description
1

activeElement

A read-only property that refers to the input element that is currently active (i.e., has the input focus).

Ex − document.activeElement

2

all[ ]

An array of all Element objects within the document. This array may be indexed numerically to access elements in source order, or it may be indexed by element id or name.

Ex − document.all[ ]

3

charset

The character set of the document.

Ex − document.charset

4

children[ ]

An array that contains the HTML elements that are the direct children of the document. Note that this is different from the all [ ] array that contains all the elements in the document, regardless of their position in the containment hierarchy.

Ex − document.children[ ]

5

defaultCharset

The default character set of the document.

Ex − document.defaultCharset

6

expando

This property, if set to false, prevents client-side objects from being expanded.

Ex − document.expando

7

parentWindow

The window that contains the document.

Ex − document.parentWindow

8

readyState

Specifies the loading status of a document. It has one of the following four string values −

Ex − document.readyState

9

uninitialized

The document has not started loading.

Ex − document.uninitialized

10

loading

The document is loading.

Ex − document.loading

11

interactive

The document has loaded sufficiently for the user to interact with it.

Ex − document.interactive

12

complete

The document is completely loaded.

Ex − document.complete

Document Methods in IE4 DOM

This model supports all the methods available in Legacy DOM. Additionally, here is the list of methods supported by IE4 DOM −

Sr.No Property & Description
1

elementFromPoint(x,y)

Returns the Element located at a specified point.

Example: document.elementFromPoint(x,y)

Example

The IE 4 DOM does not support the getElementById() method. Instead, it allows you to look up arbitrary document elements by id attribute within the all [] array of the document object.

Here's how to find all <li> tags within the first <ul> tag. Note that you must specify the desired HTML tag name in uppercase with the all.tags( ) method.

var lists = document.all.tags("UL");

var items = lists[0].all.tags("LI");

Here is another example to access document properties using IE4 DOM method.

<html>
   
   <head>
      <title> Document Title </title>
      
      <script type="text/javascript">
         <!--
            function myFunc()
            {
               var ret = document.all["heading"];
               alert("Document Heading : " + ret.innerHTML );
               
               var ret = document.all.tags("P");;
               alert("First Paragraph : " + ret[0].innerHTML);
            }
         //-->
      </script>
      
   </head>
   <body>
      <h1 id="heading">This is main title</h1>
      <p>Click the following to see the result:</p>
      
      <form id="form1" name="FirstForm">
         <input type="button" value="Click Me" onclick="myFunc();" />
         <input type="button" value="Cancel">
      </form>
      
      <form d="form2" name="SecondForm">
         <input type="button" value="Don't ClickMe"/>
      </form>
      
   </body>
</html>

NOTE − This example returns objects for forms and elements and we would have to access their values by using those object properties which are not discussed in this tutorial.

Output

This is main title

Click the following to see the result: