From 983eeb75da8632d206c24046d6632700af33f7d2 Mon Sep 17 00:00:00 2001 From: allo Date: Fri, 3 Dec 2021 14:41:03 +0800 Subject: mv to .md for zh-cn\web\api\mouseevent\screenx --- files/zh-cn/web/api/mouseevent/screenx/index.html | 92 ----------------------- files/zh-cn/web/api/mouseevent/screenx/index.md | 92 +++++++++++++++++++++++ 2 files changed, 92 insertions(+), 92 deletions(-) delete mode 100644 files/zh-cn/web/api/mouseevent/screenx/index.html create mode 100644 files/zh-cn/web/api/mouseevent/screenx/index.md (limited to 'files/zh-cn/web') diff --git a/files/zh-cn/web/api/mouseevent/screenx/index.html b/files/zh-cn/web/api/mouseevent/screenx/index.html deleted file mode 100644 index 05a83f9ba0..0000000000 --- a/files/zh-cn/web/api/mouseevent/screenx/index.html +++ /dev/null @@ -1,92 +0,0 @@ ---- -title: MouseEvent.screenX -slug: Web/API/MouseEvent/screenX -tags: - - API - - MouseEvent - - Property - - events - - 事件 - - 参考 - - 属性 - - 鼠标 - - 鼠标事件 -translation_of: Web/API/MouseEvent/screenX ---- -

{{APIRef("DOM Events")}}

- -

 screenX 是 {{domxref("MouseEvent")}} 的只读属性,提供鼠标在全局(屏幕)中的水平坐标(偏移量)。

- -

语法

- -
var pixelNumber = instanceOfMouseEvent.screenX
-
- -

返回值

- -

一个双精度浮点值。早期版本的规范将该值定义为整数值的像素数。有关详细信息,请参见浏览器兼容性部分。

- -

示例

- -

这个例子展示了当触发 {{Event("mousemove")}} 事件时鼠标的坐标。

- -

HTML

- -
<p>Move your mouse to see its position.</p>
-<p id="screen-log"></p>
- -

JavaScript

- -
let screenLog = document.querySelector('#screen-log');
-document.addEventListener('mousemove', logKey);
-
-function logKey(e) {
-  screenLog.innerText = `
-    Screen X/Y: ${e.screenX}, ${e.screenY}
-    Client X/Y: ${e.clientX}, ${e.clientY}`;
-}
- -

结果

- -

{{EmbedLiveSample("Example")}}

- -

规范

- - - - - - - - - - - - - - - - - - - - - - - - -
规范状态注释
{{SpecName('CSSOM View','#dom-mouseevent-screenx', 'screenX')}}{{Spec2('CSSOM View')}}Redefines {{domxref("MouseEvent")}} from long to double. 
{{SpecName('DOM3 Events','#widl-MouseEvent-screenX','MouseEvent.screenX')}}{{Spec2('DOM3 Events')}}No change from {{SpecName('DOM2 Events')}}.
{{SpecName('DOM2 Events','#Events-MouseEvent','MouseEvent.sceenX')}}{{Spec2('DOM2 Events')}}Initial definition
- -

浏览器兼容性

- -

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

- -

参见

- -
- - diff --git a/files/zh-cn/web/api/mouseevent/screenx/index.md b/files/zh-cn/web/api/mouseevent/screenx/index.md new file mode 100644 index 0000000000..05a83f9ba0 --- /dev/null +++ b/files/zh-cn/web/api/mouseevent/screenx/index.md @@ -0,0 +1,92 @@ +--- +title: MouseEvent.screenX +slug: Web/API/MouseEvent/screenX +tags: + - API + - MouseEvent + - Property + - events + - 事件 + - 参考 + - 属性 + - 鼠标 + - 鼠标事件 +translation_of: Web/API/MouseEvent/screenX +--- +

{{APIRef("DOM Events")}}

+ +

 screenX 是 {{domxref("MouseEvent")}} 的只读属性,提供鼠标在全局(屏幕)中的水平坐标(偏移量)。

+ +

语法

+ +
var pixelNumber = instanceOfMouseEvent.screenX
+
+ +

返回值

+ +

一个双精度浮点值。早期版本的规范将该值定义为整数值的像素数。有关详细信息,请参见浏览器兼容性部分。

+ +

示例

+ +

这个例子展示了当触发 {{Event("mousemove")}} 事件时鼠标的坐标。

+ +

HTML

+ +
<p>Move your mouse to see its position.</p>
+<p id="screen-log"></p>
+ +

JavaScript

+ +
let screenLog = document.querySelector('#screen-log');
+document.addEventListener('mousemove', logKey);
+
+function logKey(e) {
+  screenLog.innerText = `
+    Screen X/Y: ${e.screenX}, ${e.screenY}
+    Client X/Y: ${e.clientX}, ${e.clientY}`;
+}
+ +

结果

+ +

{{EmbedLiveSample("Example")}}

+ +

规范

+ + + + + + + + + + + + + + + + + + + + + + + + +
规范状态注释
{{SpecName('CSSOM View','#dom-mouseevent-screenx', 'screenX')}}{{Spec2('CSSOM View')}}Redefines {{domxref("MouseEvent")}} from long to double. 
{{SpecName('DOM3 Events','#widl-MouseEvent-screenX','MouseEvent.screenX')}}{{Spec2('DOM3 Events')}}No change from {{SpecName('DOM2 Events')}}.
{{SpecName('DOM2 Events','#Events-MouseEvent','MouseEvent.sceenX')}}{{Spec2('DOM2 Events')}}Initial definition
+ +

浏览器兼容性

+ +

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

+ +

参见

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