Home Forums General XMetaL Discussion Getting all the text children of an element in a script Reply To: Getting all the text children of an element in a script

dcramer

Reply to: Getting all the text children of an element in a script

Ok, I figured it out. Have to use a tree walker:

[code]function readtree(node) {
// Read the DOM tree
// Do if this is a DOMText node
if (node.nodeType==3) {
titleText += node.data;
}

// Process this node's children
if (node.hasChildNodes()) {
readtree(node.firstChild);
}

// Continue with this node's siblings
if (node.nextSibling != null) {
readtree(node.nextSibling)
}
}[/code]

Reply

Products
Downloads
Support