views:

19

answers:

2

Hi,

I would like to know if there is any equivalent to the jquery mousemove function in prototype.

Thanks !

+1  A: 

This answer isn't prototypejs, but you could always use the DOM API directly to assign the handler.

document.onmousemove = function() {
    // do something
};

You will have good cross-browser support unless you try to place the event on window. So use document or some other element instead.

http://www.quirksmode.org/dom/events/mousemove.html

To remove the handler later, assign null.

document.onmousemove = null;
patrick dw
+1  A: 

I think this will get you where you want to be:

Event.observe(document, 'mousemove', callBackFunction);

callbackFunction = function(event)
{
   //do something 
}
Rob Allen