📜  打印鼠标单击 x 和 y - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:09.331000             🧑  作者: Mango

代码示例1
function printMousePos(event) {
  document.body.textContent =
    "clientX: " + event.clientX +
    " - clientY: " + event.clientY;
}

document.addEventListener("click", printMousePos);