Tutorials Point


  JavaScript Basics
  JavaScript Objects
  JavaScript Advanced
  JS Useful References
  JS Useful Resources
  Selected Reading

Copyright © 2014 by tutorialspoint



  Home     References     Discussion Forums     About TP  

JavaScript - The IE 4 DOM


previous next AddThis Social Bookmark Button


Advertisements

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.

PropertyDescription & Example
activeElement A read-only property that refers to the input element that is currently active (i.e., has the input focus).
Example: 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.
Example: document.all[ ]
charsetThe character set of the document.
Example: document.charset
children[ ]An array that contains the HTML elements that are direct children of the document. Note that this is different than the all[ ] array that contains all elements in the document, regardless of their position in the containment hierarchy.
Example: document.children[ ]
defaultCharset The default character set of the document.
Example: document.defaultCharset
expando This property, if set to false, prevents client-side objects from being expanded.
Example: document.expando
parentWindow The window that contains the document.
Example: document.parentWindow
readyState Specifies the loading status of a document. It has one of the following four string values:
Example: document.readyState
uninitialized The document has not started loading.
Example: document.uninitialized
loading The document is loading.
Example: document.loading
interactive The document has loaded sufficiently for the user to interact with it.
Example: document.interactive
complete The document is completely loaded.
Example: 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:

PropertyDescription & Example
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 etc and we would have to access their values by using those object properties which are not discussed in this tutorial.

To understand it in better way you can Try it yourself.



previous next Printer Friendly

Advertisements


  

Advertisements