0

How i can get absolute mouse position on the website window without using canvas? Maybe anyone have idea? I try to find any examples, but all samples created with canvas..

Your choice
  • 395
  • 12
  • 25

1 Answers1

1

you can use following properties

MouseEvent.clientX MouseEvent.clientX

<html>
<head>
<title>clientX\clientY example</title>

<script type="text/javascript">
function showCoords(evt){
  alert(
    "clientX value: " + evt.clientX + "\n"
    + "clientY value: " + evt.clientY + "\n"
  );
}
</script>
</head>

<body onmousedown="showCoords(event)">
<p>To display the mouse coordinates click anywhere on the page.</p>
</body>
</html>
kishan
  • 454
  • 3
  • 10