#javascript-code-17-text.js / js
function text(e) { var t = ""; // If an element was passed, get it’s children, // otherwise assume it’s an array e = e.childNodes || e; // Look through all child nodes for ( var j = 0; j < e.length; j++ ) { // If it’s not an element, append its text value // Otherwise, recurse through all the element’s children t += e[j].nodeType != 1 ? e[j].nodeValue : text(e[j].childNodes); } // Return the matched text return t; }
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.