kekskurse.de/themes/nostyleplease/assets/js/mouse_coords.js
2024-07-29 00:39:26 +02:00

9 lines
No EOL
275 B
JavaScript

const p = document.createElement("p");
p.style.textAlign = "center";
p.style.fontSize = "18pt";
p.innerHTML = "C'mon, move your mouse!"
document.body.append(p);
document.addEventListener("mousemove", e => {
p.innerHTML = `mouseX: ${e.clientX}, mouseY: ${e.clientY}`;
});