All HTML elements have a bounding rect. I want to know what that bounding rect is relitive to the document window. Does anybody know how to find this using JavaScript?
Adrian
Adrian
function locate(hoo){
var T=0,L=0;
while(hoo){
L+= hoo.offsetLeft || 0;
T+= hoo.offsetTop || 0;
if(hoo== document.body) break;
hoo= hoo.parentNode;
}
var A= [L,T];
return A;
}
Comment