|
Post by Schubaltz on Feb 23, 2008 17:47:57 GMT -5
Description: Self-explanatory.
Syntax: ascendHierarchy(reference Node, offset)
function ascendHierarchy(a, b) { var x = 0; while(x < b) { if(!a.parentNode) return false; a = a.parentNode; x ++; } return a; }
Example:
<html> <head></head> <body><div><b><span id="msr">Hello World</span></b></div> <script> ascendHierarchy(document.getElementById("msr"), 4); // object HTMLBodyElement </script> </body> </html>
|
|