Try something like
Discalimer: Not sure about IE
document.getElementById('drag').onmouseup = function(event){
var event = event || window.event;
var x = event.pageX - this.offsetLeft;
var y = event.pageY - this.offsetTop;
document.getElementById('pos').innerHTML = x + ', ' + y;
}
Demo: Fiddle
solved How to get the document(page) left and top along with its scroll(scroll left and top) relative to the body? [closed]