SnowCrash
01-03-2004, 09:57 AM
I would like to register the mouse event of leaving a browser window. In IE I can do something like this:
function CheckMousePos(e) {
var X = event.clientX;
var Y = event.clientY;
if (X < 0 || Y < 0) DoSomething();
}
document.attachEvent("onmouseout", CheckMousePos);
But in Mozilla the clientX & clientY property is not updated anymore as soon as the mouse has left the window.
Therefore I tried to use the property e.relatedTarget, which is null if moused out of the window. But it is also null at at some places inside the browser window ?
Any suggestions ?
function CheckMousePos(e) {
var X = event.clientX;
var Y = event.clientY;
if (X < 0 || Y < 0) DoSomething();
}
document.attachEvent("onmouseout", CheckMousePos);
But in Mozilla the clientX & clientY property is not updated anymore as soon as the mouse has left the window.
Therefore I tried to use the property e.relatedTarget, which is null if moused out of the window. But it is also null at at some places inside the browser window ?
Any suggestions ?