diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/mouseevent/clienty | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/mouseevent/clienty')
-rw-r--r-- | files/zh-cn/web/api/mouseevent/clienty/index.html | 83 |
1 files changed, 83 insertions, 0 deletions
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 +--- +<p>{{APIRef("DOM Events")}}</p> + +<p><strong><code>MouseEvent.clientY</code></strong> 是只读属性, 它提供事件发生时的应用客户端区域的垂直坐标 (与页面坐标不同)。例如,当你点击客户端区域的左上角时,鼠标事件的 <code>clientY</code> 值为 0 ,这一值与页面是否有垂直滚动无关。</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox">var <em>y</em> = <em>instanceOfMouseEvent</em>.clientY +</pre> + +<h3 id="Return_value">Return value</h3> + +<p>被 CSSOM View Module 重新定义为一个 <code>double</code> 类型的浮点值. 原来这个属性是被定义为一个 <code>long</code> 整数. 可以在 "浏览器兼容性" 那里查看详细内容.</p> + +<h3 id="Example" name="Example">Example</h3> + +<pre class="brush: js"><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> +</pre> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('CSSOM View','#dom-mouseevent-clienty', 'clientY')}}</td> + <td>{{Spec2('CSSOM View')}}</td> + <td>Redefines {{domxref("MouseEvent")}} from <code>long</code> to <code>double</code>.</td> + </tr> + <tr> + <td>{{SpecName('DOM3 Events','#widl-MouseEvent-clientY','MouseEvent.clientY')}}</td> + <td>{{Spec2('DOM3 Events')}}</td> + <td>No change from {{SpecName('DOM2 Events')}}.</td> + </tr> + <tr> + <td>{{SpecName('DOM2 Events','#Events-MouseEvent','MouseEvent.clientY')}}</td> + <td>{{Spec2('DOM2 Events')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</h2> + + + +<p>{{Compat("api.MouseEvent.clientY")}}</p> + +<h2 id="See_also" name="See_also">查看更多</h2> + +<ul> + <li>{{ domxref("MouseEvent") }}</li> + <li>{{domxref("MouseEvent.clientX","clientX")}}</li> + <li>{{domxref("MouseEvent.screenX","screenX")}} / {{domxref("MouseEvent.screenY","screenY")}}</li> +</ul> |