From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/api/mouseevent/clienty/index.html | 83 +++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 files/zh-cn/web/api/mouseevent/clienty/index.html (limited to 'files/zh-cn/web/api/mouseevent/clienty') diff --git a/files/zh-cn/web/api/mouseevent/clienty/index.html b/files/zh-cn/web/api/mouseevent/clienty/index.html new file mode 100644 index 0000000000..2c682695d9 --- /dev/null +++ b/files/zh-cn/web/api/mouseevent/clienty/index.html @@ -0,0 +1,83 @@ +--- +title: MouseEvent.clientY +slug: Web/API/MouseEvent/clientY +tags: + - CSSOM View + - MouseEvent +translation_of: Web/API/MouseEvent/clientY +--- +

{{APIRef("DOM Events")}}

+ +

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

+ +

语法

+ +
var y = instanceOfMouseEvent.clientY
+
+ +

Return value

+ +

被 CSSOM View Module 重新定义为一个 double 类型的浮点值. 原来这个属性是被定义为一个 long 整数. 可以在 "浏览器兼容性" 那里查看详细内容.

+ +

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>
+
+ +

规范

+ + + + + + + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('CSSOM View','#dom-mouseevent-clienty', 'clientY')}}{{Spec2('CSSOM View')}}Redefines {{domxref("MouseEvent")}} from long to double.
{{SpecName('DOM3 Events','#widl-MouseEvent-clientY','MouseEvent.clientY')}}{{Spec2('DOM3 Events')}}No change from {{SpecName('DOM2 Events')}}.
{{SpecName('DOM2 Events','#Events-MouseEvent','MouseEvent.clientY')}}{{Spec2('DOM2 Events')}}Initial definition.
+ +

浏览器兼容性

+ + + +

{{Compat("api.MouseEvent.clientY")}}

+ +

查看更多

+ + -- cgit v1.2.3-54-g00ecf