<div id="overel" style="position: absolute; top: 100px; left: 100px; width: 100px; height: 100px; background-color: #f00;"></div>
<script type="text/javascript">
document.getElementById( 'overel' ).onmousemove = function( e ) {
var e = e || window.event;
( e.target || e.srcElement ).innerHTML = "X: " + ( e.layerX || e.offsetX ) + ", Y: " + ( e.layerY || e.offsetY );
}
</script>