<!DOCTYPE HTML>
<html>
<head>
<style>
html, body {
height: 100%;
}
</style>
</head>
<body>
<p>X: <input id="resultX" type="text"></p>
<p>Y: <input id="resultY" type="text"></p>
<script>
var result = {
x: document.getElementById('resultX'),
y: document.getElementById('resultY')
};
document.body.onmousemove = function(e) {
e = e || window.event;
result.x.value = e.clientX;
result.y.value = e.clientY;
}
</script>
</body>
</html>