Heres an example of code that accounts for all possible situations: Heres the full example with all details: Try to move the cursor in and out of table cells and inside them. This is usually undesirable behavior. Theres no function like getCurrentMouseCoordinates().