Hey Ben, I will email you the script, but I have fixed this.
The bulk of the code modification is the following addition
of a helper
function. If people can attest that it works on many
browsers, then
everything else is easy.
What's the custom here? do I just paste the code in here? or
send
someone an email?
// helper recursion function
// determines if root is a parent of el
function getChildElementById_( el, current , root)
{
if( current == root )
return el;
if( current == null )
return null;
return getChildElementById_( el, current.parentNode,
root );
}
// does the equivalent of root.getElementById() by
verifying if
// root is the ancestor of document.getElementById(id)
function getChildElementById(id, root)
{
var el = document.getElementById( id );
if( !el )
return el;
return getChildElementById_( el, el, root );
}
|