13 lines
431 B
JavaScript
13 lines
431 B
JavaScript
// xParent, Copyright 2001-2005 Michael Foster (Cross-Browser.com)
|
|
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
|
|
|
|
function xParent(e, bNode)
|
|
{
|
|
if (!(e=xGetElementById(e))) return null;
|
|
var p=null;
|
|
if (!bNode && xDef(e.offsetParent)) p=e.offsetParent;
|
|
else if (xDef(e.parentNode)) p=e.parentNode;
|
|
else if (xDef(e.parentElement)) p=e.parentElement;
|
|
return p;
|
|
}
|