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.
The following non-standard (and non-portable) properties are defined by Internet Explorer 4 and later versions.
activeElement
A read-only property that refers to the input element that is currently active (i.e., has the input focus).
Ex − document.activeElement
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[ ]
charset
The character set of the document.
Ex − document.charset
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[ ]
defaultCharset
The default character set of the document.
Ex − document.defaultCharset 
expando
This property, if set to false, prevents client-side objects from being expanded.
Ex − document.expando 
parentWindow 
The window that contains the document.
Ex − document.parentWindow
readyState 
Specifies the loading status of a document. It has one of the following four string values −
Ex − document.readyState
uninitialized 
The document has not started loading.
Ex − document.uninitialized
loading
The document is loading.
Ex − document.loading
interactive
The document has loaded sufficiently for the user to interact with it.
Ex − document.interactive
complete
The document is completely loaded.
Ex − document.complete
This model supports all the methods available in Legacy DOM. Additionally, here is the list of methods supported by IE4 DOM −
elementFromPoint(x,y)
Returns the Element located at a specified point.
Example: document.elementFromPoint(x,y)
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.
Click the following to see the result:

    25 Lectures 
     2.5 hours 

 Anadi Sharma

    74 Lectures 
     10 hours 

 Lets Kode It

    72 Lectures 
     4.5 hours 

 Frahaan Hussain

    70 Lectures 
     4.5 hours 

 Frahaan Hussain

    46 Lectures 
     6 hours 

 Eduonix Learning Solutions

    88 Lectures 
     14 hours 

 Eduonix Learning Solutions
 Print
 Add Notes
 Bookmark this page