Mouse Cursor Position By javascript and HTML

 MOUSE CURSOR POSITION BY JAVASCRIPT


<!DOCTYPE html>
<html onmousemove="showCoords(event)">
<body >

<h1 align="center" style="color:rgb(123, 117, 212)">
Move Your Mouse and Get Position of Cursor</h1>

<p id="demo"></p>

<script>
function showCoords(event) {
  var x = event.clientX;
  var y = event.clientY;
  var coords = "X coords: " + x + ", Y coords: " + y;
  document.getElementById("demo").innerHTML = coords;
}
</script>

</body>
</html>

OUTPUT


Move Your Mouse and Get Position of Cursor

Comments