tags:

views:

76

answers:

2

i know that there are websites which can detect where the mouse is moving on the screen on a website, and then display a movie of that visit. like robotreplay or clicktale.

how do they do that?

A: 

The mousemove event.

Matthew Flaschen
+4  A: 

Use the onmousemove event handler to capture the mouse move. Than you can read the x and y coordinates of the mouse cursor:

window.onmousemove = function(e) {
    document.documentElement.innerHTML = e.x + ":" + e.y;
};
Gumbo
thanks, do you know how i could convert this information into a movie? i would be running this on a php page.
chris
Just record this data (I’d use a fixed period of time for recording, so that not every little movement is recorded). Then you can replay it. But I’m afraid that you cannot move the actual cursor but just a cursor replacement (an image of a cursor).
Gumbo
thanks, do you know the function on how to move an image across the screen from one pixel to another pixel?
chris
Position the element absolute and then move it around the screen with the `top` and `left` CSS properties.
Gumbo