clientX 属性.

Syntax:

  

event.clientX

The clientX event attribute returns the horizontal coordinate (according to the client area) of the mouse pointer when an event was triggered.

The client area is the current window.

e.g:

 <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>

Note that the literal event can not be changed,or it won't work.

上一篇:tcp黏包


下一篇:linux高级技巧:rsync同步(一个)