↑
Main Page
Getting the screen coordinates
Getting the screen coordinates
During mouse events, you can retrieve the location of the mouse cursor in relation to the computer
screen by using the
screenX
and
screenY
properties:
var iScreenX = oEvent.screenX;
var iScreenY = oEvent.screenY;
Each of these properties returns an integer representing the number of pixels from the edge of the user’s
screen (see Figure 9-8).
Figure 9-8
Differences
Of course, not everything in Internet Explorer and the DOM is similar. This section describes the differ-
ence that you should be aware of when scripting for cross-browser support.
(screenX,screenY)
276
Chapter 9
12_579088 ch09.qxd 3/28/05 11:39 AM Page 276
Free JavaScript Editor
Ajax Editor
©
→