Not sure exactly what's wrong with that, but this works
Code:
document.getElementById('id').onmousemove=function(e) {
var blah = mousepos(e);
alert(blah.x);
alert(blah.y);
};
function mousepos(e) {
var x = 0;
var y = 0;
if (window.event) {
x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
} else {
x = e.clientX;
y = e.clientY;
}
return({x:x,y:y});
}
__________________