ScreenX event properties
The event objectDefinitions and usages
The screenX event property returns the horizontal coordinates of the mouse pointer relative to the screen when the event occurred.
Grammar
The following example shows the coordinates of the mouse pointer at the time of the event:
<html>
<head>
<meta charset="utf-8">
Online tutorials for W3Cschool (w3cschool.cn)
<script type="text/javascript">
function coordinates(event){
x=event.screenX
y=event.screenY
alert("X=" + x + " Y=" + y)
}
</script>
</head>
<body onmousedown="coordinates(event)">
<p>
Click a location in the document. The message box prompts for the x and y coordinates of the pointer relative to the screen.
</p>
</body>
</html>
Try it out . . .
The event object