Source Code: (back to article)
<!DOCTYPE html>
<html lang="en">
<head>
<title>Client-Side Coordinates Example</title>
</head>
<body style="height: 2000px;">
<div id="container" onclick="showCoords(event)">Click anywhere in the grey area to see Client-Side coordinates!</div>
<script>
function showCoords(event) {
alert("Client-Side X: " + event.clientX + ", Y: " + event.clientY);
}
</script>
</body>
<style>
#container {
width: 100%;
height: 100%;
background-color: grey;
min-height: 40px;
}
</style>
</html>