Sparrow's Lair

Just my random musing on life, being a sparrow at various places in the world and all things development related

Wednesday, May 24, 2006

Mouse Coordinates

One thing that has really irritated me lately is trying to find a decent script to get the co-ordinates of the mouse cursor when mousing over a specific portion of a page e.g. trying to create a simple mouseover menu. All the scripting examples I've been able to find all require you to trap the mousemove event.

So - after much searching - for your edification and my own I present:

The definitive guide to getting where the heck your mouse is on a mouseover - or something to that effect

var mouseLeft = event.clientX;
var mouseTop = event.clientY;

And it's as simple as that!

0 Comments:

Post a Comment

<< Home