자바스크립트에서 커서의 좌표를 찾으려면 event.를 사용하세요. 클라이언트X 및 event.clientY. 다음 코드를 실행하여 JavaScript에서 커서 좌표를 얻을 수 있습니다.
예시
<!DOCTYPE html>
<html>
<head>
<script>
function coordinatesFunc(event) {
document.write("Coordinate(X) = " + event.clientX + "<br>Coordinate(Y) = " + event.clientY);
}
</script>
</head>
<body>
<div onmousedown="coordinatesFunc(event)">Click me to get coordinates of cursor</p>
</body>
</html>