clientY
clientY 事件属性
定义和用法
clientY 事件属性返回当事件被触发时鼠标指针向对于浏览器页面(客户区)的垂直坐标。 客户区指的是当前窗口。
语法
event.clientY
实例
下面的例子可显示出事件发生时鼠标指针的坐标:
<html>
<head>
<script>
function show_coords(event)
{
var x=event.clientX
var y=event.clientY
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 mouse pointer.</p>
</body>
</html>
<head>
<script>
function show_coords(event)
{
var x=event.clientX
var y=event.clientY
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 mouse pointer.</p>
</body>
</html>