function getElementOffset(e) { var t = e.offsetTop; var l = e.offsetLeft; var w = e.offsetWidth; var h = e.offsetHeight - 1 ; while (e = e.offsetParent) { t += e.offsetTop; l += e.offsetLeft; } return { top : t, left : l, width : w, height : h } }