-
Notifications
You must be signed in to change notification settings - Fork 0
/
鼠标位置.html
26 lines (26 loc) · 849 Bytes
/
鼠标位置.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<style>
body {
width: 1000px;
height: 2000px;
}
</style>
<body style="background-color: lightpink">
<div class="box" style="margin: 60px; width: 500px; height: 500px; background-color: lightblue"></div>
<script>
const box = document.querySelector(".box");
document.body.addEventListener("mousedown", function (e) {
const { clientX, pageX, clientY, pageY, offsetX, screenX } = e;
console.log(clientX, pageX, clientY, pageY, offsetX, screenX);
console.dir(e.target);
});
</script>
</body>
</html>