Menu
I thought the code below is full-cross browser to capture the mouse position. It looks like Mozilla (at least Firefox and Moz 1.7) don’t follow it? Why? What’s wrong?
[code=php]
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<head>
<script>
function showMouse(e)
{
var posx = 0;
var posy = 0;
if (!e) var e = window.event;
if (e.pageX || e.pageY)
{
posx = e.pageX;
posy = e.pageY;
}
else if (e.clientX || e.clientY)
{
posx = e.clientX + document.body.scrollLeft;
posy = e.clientY + document.body.scrollTop;
}
alert(posx);
}
</script>
</head>
<body onmousemove=”showMouse()”>
</body>
</html>