spacer
Yehuda Shiran December 30, 1999
The DOM's Properties
Tips: December 1999

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
OpenOffice 3.2 Lands Amid Critical Changes
Red Hat, IBM Firmly in KVM Virtualization Camp
Red Hat Talks Up Open Source Cloud Plans

The Document Object Model provides a set of properties that you can use to navigate, access, and update the document tree with. The following table shows the read-only properties:

DOM's PropertyReturnsComments
firstChildThe first child node.An [object]. All children are included in childNodes collection.
lastChildThe last child node.An [object]. All children are included in childNodes collection.
nextSiblingThe next child of the node's parent.An [object].
nodeNameThe HTML Tag.Examples: P, FONT, UL.
nodeTypeWhether the node is a tag, text, or attribute.Returns 1 for tag, 2 for attribute, and 3 for text.
parentNodeA reference to the parent node.An [object].
previousSiblingA reference to the previous child of the node's parent.An [object].
specifiedWhether an attribute value is set.Boolean

The following table shows the read-write properties:

DOM's PropertyReturnsComments
dataThe value of a text node.A string. Returns undefined for all other nodes. Can be set as well.
nodeValueThe value of a text node.A string. Returns null for all other nodes. Can be set as well.

And finally, here are the collections defined for the DOM:

DOM's PropertyReturnsComments
attributesA collection of the node's attributes.Access by name. Example:attributes.id.
childNodesA collection of the node's children.Access by index. Example:childNodes[2].

Learn all about the DOM in Column 40, The DOM, Part I: Analysis.


People who read this tip also read these tips:

Look for similar tips by subject:


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

webref The latest from WebReference.com Browse >
Are Google's Language Translation Web Services Ready for Prime Time? · Installing and Using Meeplace, the Business Review CMS · Sending an HTML and Plain Text E-newsletter with ASP.NET, Part 2
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
ANSI SQL Hierarchical Data Processing Basics · Top 10 Threats to Wireless Security · Nuvio Intros NuvioFlex Virtual PBX