D
Danny@Kendal
How can I get the coordinates of the mouse cursor in Mozilla browsers as
well as Opera and IE6?
I'm struggling to understand how to capture mouse movement events with
Mozilla/Netscape/Firefox and I've Googled so much my brain hurts.
http://www.ghpkendal.co.uk/TestPages/Test.htm
Move your cursor over the yellow area and you should see the mouse
coordinates echoed above.
The following javascript function works for Opera and IE6 when called by
onMouseMove="moveDiv()". How do I adapt it to cope with the browser versions
mentioned above?
The code snippet in question is listed below. I've not included any feature
detection to keep things simple.
divX & divY are locally declared numerical variables in the test page.
'cpos' is the ID of a <div> element used to display the mouse cursor
coordinates.
function movement()
{
divX = event.x
divY = event.y
document.getElementById('cpos').innerHTML = "X=" + divX + "<br>Y=" + divY
}
well as Opera and IE6?
I'm struggling to understand how to capture mouse movement events with
Mozilla/Netscape/Firefox and I've Googled so much my brain hurts.
http://www.ghpkendal.co.uk/TestPages/Test.htm
Move your cursor over the yellow area and you should see the mouse
coordinates echoed above.
The following javascript function works for Opera and IE6 when called by
onMouseMove="moveDiv()". How do I adapt it to cope with the browser versions
mentioned above?
The code snippet in question is listed below. I've not included any feature
detection to keep things simple.
divX & divY are locally declared numerical variables in the test page.
'cpos' is the ID of a <div> element used to display the mouse cursor
coordinates.
function movement()
{
divX = event.x
divY = event.y
document.getElementById('cpos').innerHTML = "X=" + divX + "<br>Y=" + divY
}