<!DOCTYPE html>
<html>
<body onclick="showCoords(event)" style="border:1px solid black;padding:4px">
<h1>Mouse Events</h1>
<h2>The clientX and clientY Properties</h2>
<div>
<p>Click anywhere in this document to get the x and y coordinates of the mouse pointer, relative to the window.</p>
<p id="demo">Coordinates:</p>
</div>
<script>
function showCoords(event) {
let x = event.clientX;
let y = event.clientY;
let text = "X coords: " + x + ", Y coords: " + y;
document.getElementById("demo").innerHTML = text;
}
</script>
</body>
</html>