MDN wants to learn about developers like you: https://qsurvey.mozilla.com/s3/MDN-dev-survey

MouseEvent.clientY

这篇翻译不完整。请帮忙从英语翻译这篇文章

MouseEvent.clientY 是只读属性, 它提供事件发生时的应用客户端区域的垂直坐标 (与页面坐标不同)。例如,当你点击客户端区域的左上角时,鼠标事件的 clientY 值为 0 ,这一值与页面是否有垂直滚动无关。

Syntax

var y = instanceOfMouseEvent.clientY

Return value

一个number类型

Example

<html>
<head>
<title>clientX\clientY example</title>

<script type="text/javascript">
function showCoords(evt){
  alert(
    "clientX value: " + evt.clientX + "\n"
    + "clientY value: " + evt.clientY + "\n"
  );
}
</script>
</head>

<body onmousedown="showCoords(event)">
<p>To display the mouse coordinates click anywhere on the page.</p>
</body>
</html>

Specifications

Specification Status Comment
CSS Object Model (CSSOM) View Module
clientY
Working Draft Redefines MouseEvent from long to double
Document Object Model (DOM) Level 3 Events Specification
MouseEvent.clientY
Obsolete No change from Document Object Model (DOM) Level 2 Events Specification.
Document Object Model (DOM) Level 2 Events Specification
MouseEvent.clientY
Obsolete Initial definition.

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) (Yes) (Yes) 6 (Yes) (Yes)
Redefined from long to double 56 ? ? ? ? ?
Feature Android Webview Chrome for Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) (Yes) (Yes) ? ? ? ?
Redefined from long to double 56 56 ? ? ? ? ?

See also

文档标签和贡献者

 此页面的贡献者: linfengdoor
 最后编辑者: linfengdoor,