自强学堂
自强学堂:学习、分享、让你更强!
JavaScript 参考手册HTMLCSSJAVASCRIPTJQUERYSQLPHPBOOTSTRAPANGULARXML
 

screenY 事件属性

事件对象参考手册 事件对象

定义和用法

screenY 事件属性可返回事件发生时鼠标指针相对于屏幕的垂直坐标。

语法

event.screenY


实例

实例

下面的例子可显示出事件发生时鼠标指针的坐标:

<html>
<head>
<script>
function show_coords(event)
  {
  var x=event.screenX
  var y=event.screenY
  alert("X coords: " + x + ", Y coords: " + y)
  }
</script>
</head>
<body>

<p onmousedown="show_coords(event)">Click this paragraph, and an alert box will alert the x and y coordinates of the cursor.</p>

</body>
</html>

尝试一下 »


事件对象参考手册 事件对象