.... Ian's: Articles collection |
Books
DOM Interface Examples
As described in the August 2002 issue of CPU - Computer Power User magazine.
Note: These examples were taken from Chapter 3 of my book
The XHTML 1.0 Web Development Sourcebook, published by John Wiley and Sons.
Examples
- test-xml.xml -- Test XML document -- load
this document into the Mozilla) or
Netscape 6/7 browsers, and the
browser will automatically load in the JavaScript program
tree-traverse.js (see next item). A plain
text listing of this XML document is also available at
test-xml.txt.
- tree-traverse.js.txt --
This is the source listing for the function tree-traverse.js. If
you want to store it locally and use it, don't forget to remove the
'txt' from the filename extension
- example-ie5.html --
The example re-worked for use with Internet Explorer 5 and greater --
In this case the HTML document loads the script which then loads
in the 'external' XML document test-xml.xml and processes
it as before. This is all done using an extenal JavaScript
program named tree-traverse-ie5.js.
you want to store it locally and use it, don't forget to remove the
'txt' from the filename extension
- tree-traverse-ie5.js.txt --
This is the source listing for the function tree-traverse-ie5.js. If
you want to store it locally and use it, don't forget to remove the
'txt' from the filename extension. Note that the file defines
some property variables (e.g. Node.ELEMENT_TYPE) that were not
defined in early Microsoft implementations of hte DOM interface.
(e.g. those provided with early versions of IE 5.0). These
omissions were fixed in later parser versions .
Additional References