screenX 事件属性

定义和用法

screenX 事件属性可返回事件发生时鼠标指针相对于屏幕的水平坐标。

语法

event.screenX

实例

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

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

<p>Click in the document. An alert box will alert 
the x and y coordinates of the cursor.</p>

</body>
</html>

TIY

screenX
提示鼠标指针的坐标。
系统帮助 | 给我留言 | 收藏本站
Copyright © 2005-2008 www.cnn84.com All Rights Reserved Ver:2.0
CNN84网是公益性便民网站,是为了给大家的日常生活查询及提供最快捷的出行指南