var box = document.getElementById( "gaga1" );
/* alert( box.getBoundingClientRect().top );
alert( box.getBoundingClientRect().right );
alert( box.getBoundingClientRect().bottom );
alert( box.getBoundingClientRect( ).left ) */
function getRect( elements ){
var rect = elements.getBoundingClientRect();
var clientTop = document.documentElement.clientTop;
var clientLeft = document. documentElement.clientLeft;
return { // Compatible with the two extra pixels in IE
top : rect.top - clientTop, // Position from the top
bottom : rect.bottom - clientTop, // Distance The top plus the height of the element itself is equal to the position of the bottom
left : rect.left - clientLeft, // The position from the left
right : rect.right - clientLeft // The position from the right is the position from the left Plus the width of the element itself
};
};
alert( getRect(box).top )