<input id="mouseX"> <input id="mouseY"> <script> document.onmousemove = function mouseMove(event){ document.getElementById('mouseX').value = event.clientX; document.getElementById('mouseY').value = event.clientY; } </script>