Please login or register. Welcome to the Studio, guest!


Quick Links:


newBookmarkLockedFalling

Zero Tolerance

Zero Tolerance Avatar

*
New Member

21


October 2005
The code is as described in the title, it will capture mouse movements and record the x and y position within 2 seperate variables.

ddMM = function()
{
e = arguments[0]

try
{
document.mouse_x = e.clientX
document.mouse_y = e.clientY
}
catch(e)
{
try
{
document.mouse_x = window.event.x + document.body.scrollLeft
document.mouse_y = window.event.y + document.body.scrollTop
}
catch(e)
{
try
{
        document.mouse_x = e.pageX
        document.mouse_y = e.pageY
}
catch(e)
{
alert('Could not initiate mouse movements, please report.')
return false
}
}
}
}

try
{
document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = ddMM
}
catch(e)
{
try
{
document.onmousemove = ddMM
}
catch(e)
{
alert('Could not initiate mousemove')
}
}


Feel free to post any fixes/additions as it was a quick draught I wrote up :)

- Zero Tolerance


Last Edit: Nov 4, 2005 17:14:42 GMT by Zero Tolerance

newBookmarkLockedFalling