Here's a cross-browsers solution:
PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script>
function checkS(e){
// capture the mouse position
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;
posy = e.clientY;
}
document.getElementById('pos').innerHTML = 'Mouse position is: X='+posx+' Y='+posy;
}
</script>
</head>
<body onmousemove="checkS(event)">
<div id="pos"></div>
</body>
</html>
Bookmarks