GetParentNodeWithClassName( objNode, strClassName )

Downloadable Files

dom_get_parent_node_with_class_name.htm ( 3,671 Bytes )

his method is used to crawl up the document object model (DOM) looking for a parent node with the given class name. There are some caveats to take into account. If you are searching for a node that doesn't exist, the DOM will crawl up to the Document object. This is a stuctured node (NOT node type 3) but is NOT a tag. So, when crawling, you have keep checking parent nodes even when you don't have a HTML node to check against - otherwise, searching for non-existent parent will return the document object, and not the intended NULL.

Added April 22, 2006 / Updated April 22, 2006