-7

Using JavaScript, I would like to find the x-y coordinates of cursor pointer on the screen in a HTML webpage.

Ravi
  • 372
  • 1
  • 7
  • 24

1 Answers1

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