J
Jean-Francois Larvoire
Hi,
I wrote code to highlight cells in an HTML table when the mouse flies over
them.
The code works well, except for a strange problem:
When the mouse enters a cell, I get 3 events for the cell: MouseOver;
MouseOut; MouseOver.
Then when the mouse leaves the cell, I also get 3 events: MouseOut;
MouseOver; MouseOut. (And 3 more when it enters the neighbouring cell)
Of course, I expected a single MouseOver on entry, and a single MouseOut on
exit.
I suspect something related to style, as if I enter a cell moving the mouse
very very slowly, I get the 1st MouseOver on the first pixel. As long as I
stay there, nothing more occurs. Then when I move 1 more pixel inwards I get
the MouseOut event. Finally moving in a third pixel, I get the last
MouseOver event. Then I can move the mouse anywhere inside that 3-pixel
boundary with no further events.
I've set margin: 0; padding: 0; border-width:0 in the CSS, but this does not
resolve the problem.
Both IE6 and NS6 behave the same way, which seems to mean it's my code (or
my expectations) that's wrong.
The code is visible online at http://ashpgvl.free.fr/voiles/.
The only visible effect of the extra 2 events is a slight flash of the
message displayed in the status bar when passing that 2nd pixel boundary.
Any idea?
I wrote code to highlight cells in an HTML table when the mouse flies over
them.
The code works well, except for a strange problem:
When the mouse enters a cell, I get 3 events for the cell: MouseOver;
MouseOut; MouseOver.
Then when the mouse leaves the cell, I also get 3 events: MouseOut;
MouseOver; MouseOut. (And 3 more when it enters the neighbouring cell)
Of course, I expected a single MouseOver on entry, and a single MouseOut on
exit.
I suspect something related to style, as if I enter a cell moving the mouse
very very slowly, I get the 1st MouseOver on the first pixel. As long as I
stay there, nothing more occurs. Then when I move 1 more pixel inwards I get
the MouseOut event. Finally moving in a third pixel, I get the last
MouseOver event. Then I can move the mouse anywhere inside that 3-pixel
boundary with no further events.
I've set margin: 0; padding: 0; border-width:0 in the CSS, but this does not
resolve the problem.
Both IE6 and NS6 behave the same way, which seems to mean it's my code (or
my expectations) that's wrong.
The code is visible online at http://ashpgvl.free.fr/voiles/.
The only visible effect of the extra 2 events is a slight flash of the
message displayed in the status bar when passing that 2nd pixel boundary.
Any idea?