T
Thomas Mlynarczyk
Hi,
I have a JavaScript application which opens a second window. Which is the
best way to detect over which (if any) of the two windows the mouse is?
First I thought document.onmouseout and document.onmouseover (for both
windows) would be the way to do it, but some browsers (like Firefox) seem to
fire these even when the mouse passes within the document (like from the
"empty body background" to a div), and anyway, any child elements of
document would "get" the events before the document (event bubbling), so my
script would still "think" the mouse is over the other window. Using
onfocus/onblur does not seem to be the right idea either as it would require
something like a click in a window to trigger them. Now the only more or
less promising way I can think of is to set a reference to the respective
window on each object I want to handle events for. But then I'd have to take
care about the cyclic references this would create. So what could I do? Is
there a simple solution?
Thanks in advance for your advice,
Thomas
I have a JavaScript application which opens a second window. Which is the
best way to detect over which (if any) of the two windows the mouse is?
First I thought document.onmouseout and document.onmouseover (for both
windows) would be the way to do it, but some browsers (like Firefox) seem to
fire these even when the mouse passes within the document (like from the
"empty body background" to a div), and anyway, any child elements of
document would "get" the events before the document (event bubbling), so my
script would still "think" the mouse is over the other window. Using
onfocus/onblur does not seem to be the right idea either as it would require
something like a click in a window to trigger them. Now the only more or
less promising way I can think of is to set a reference to the respective
window on each object I want to handle events for. But then I'd have to take
care about the cyclic references this would create. So what could I do? Is
there a simple solution?
Thanks in advance for your advice,
Thomas