Easy Tutorial
❮ Prop Email Readonly Dom Obj Number ❯

screenX Event Property


Definition and Usage

The screenX event property returns the horizontal coordinate of the mouse pointer relative to the screen when the event occurs.

Syntax


Example

Example

The following example displays the coordinates of the mouse pointer when an event occurs:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>tutorialpro.org(tutorialpro.org)</title>
<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 somewhere in the document. A message box will show the x and y coordinates of the pointer relative to the screen.
</p>

</body>
</html>

❮ Prop Email Readonly Dom Obj Number ❯