|
Posted by Neredbojias on 05/30/06 01:20
To further the education of mankind, Andrew <infoREMOVE@THISmuonlab.com>
vouchsafed:
> Hi,
>
> In the following code, if I move my mouse across the row from left to
> right, events are fired in the following order
>
> <table>
> <tr onmouseover="alert('TRover');" onmouseout="alert('TRout');">
> <td onmouseover="alert('TDover');" onmouseout="alert('TDout');">One</td>
> <td onmouseover="alert('TDover');" onmouseout="alert('TDout');">Two</td>
> </tr>
> </table>
>
>
> TDOver (one), TROver, TDOut (one), TROut, TDOver (Two), TROver, TDOut
> (Two), TROut.
>
>
> Why is the TROver and TROut even fired when moving the mouse between TDs
> in the same row, i havent left the tr tag?
>
> And more importantly, what can I do about it? I want to fire a JS
> function on TR over and TR out, but its fired when moving between cells
> as well which is a right pain!
>
> Is there any workaround for this?
Yes. It's simple. I've done it - many times. You just need timing loops
and possibly specific-location iding.
The idea is roughly this: delay the execution of the mouseout code a bit
and cancel it completely if a new mouseover event occurs _in the same row_.
Depending on what you are actually trying to do with the mouseovers, you
may be able to cancel the -out code on _any_ -over. Each situation is
slightly different but the main method is the same.
Generally, I'd use events on the cells only, not the rows. It might be a
bit more hassle but I think it works better in the long run.
--
Neredbojias
Infinity has its limits.
Navigation:
[Reply to this message]
|