
Added by thebman220 on April-5-2009, 1:48 pm
/**
* @purpose : Get the (x,y) coordinate of a DOM element
* @param object elem : a DOM element or null
* @return object : an associative array, where indicies "x"
* and "y" hold their respective coordinates
* @note : function is recursive
*/
function getXYpos(elem) {
if (!elem) {
return {"x":0,"y":0};
}
var xy={"x":elem.offsetLeft,"y":elem.offsetTop}
var par=getXYpos(elem.offsetParent);
for (var key in par) {
xy[key]+=par[key];
}
return xy;
}
Added by thebman220 on May-2-2009, 4:40 am
Added by thebman220 on April-29-2009, 11:47 pm
Added by thebman220 on January-29-2009, 3:15 am
Added by thebman220 on January-29-2009, 3:04 am
Added by thebman220 on January-3-2009, 6:25 pm