We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

MouseEvent.screenY

screenYMouseEvent的只读属性,它提供了鼠标相对于屏幕坐标系的垂直偏移量。

语法

var pixelNumber = instanceOfMouseEvent.screenY

返回值

一个double值。早期版本的规格定义这是一个 整数指的像素数。有关详细信息,请参见浏览器兼容性部分。

样例

<html>
<head>
<title>screenX\screenY example</title>

<script type="text/javascript">

function showCoords(evt){
  alert(
    "screenX value: " + evt.screenX + "\n"
    + "screenY value: " + evt.screenY + "\n"
  );
}

</script>
</head>

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

规范

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

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Edge Firefox (Gecko) Chrome Internet Explorer Opera Safari
Basic support (Yes) (Yes) (Yes) 6 (Yes) (Yes)
Feature Edge Firefox Mobile (Gecko) Android IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) (Yes) (Yes) (Yes) (Yes) (Yes)

参见

文档标签和贡献者

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