Latest web development tutorials

screenX event properties

Event Object Reference Event objects

Definition and Usage

screenX event property returns the mouse pointer when the event occurs with respect to the horizontal coordinate of the screen.

grammar

event.screenX


Examples

Examples

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

<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ 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 on a location in the document. The message box will prompt pointer relative to the screen's x and y coordinates.
</ P>

</ Body>
</ Html>

try it"


Event Object Reference Event objects