Using JavaScript, I would like to find the x-y coordinates of cursor pointer on the screen in a HTML webpage.
Asked
Active
Viewed 1,014 times
-7
-
5Have you searched at all for this? Resources exist for this everywhere. – Carcigenicate Jul 02 '17 at 15:22
1 Answers
1
This will tell you the current x-y coordinates.(displayed in console)
function move(e){
console.log("x" + e.clientX);
console.log("y" + e.clientY);
}
.box{
width: 600px;
height: 500px;
border: 1px solid black;
}
<body>
<div class="box" onmousemove="move(event)">
</div>
</body>

Goofy
- 210
- 1
- 3
- 17