Here's something old. Stll working fine:
Code:
<html>
<head>
<!--
This file retrieved from the JS-Examples archives
http://www.js-examples.com
1000s of free ready to use scripts, tutorials, forums.
Author: JS-Examples - http://www.js-examples.com/
-->
<script type=text/javascript>
var isIE = document.all?true:false;
if (!isIE) document.captureEvents(Event.CLICK);
document.onclick = getMousePosition;
function getMousePosition(e) {
var _x;
var _y;
if (!isIE) {
_x = e.pageX;
_y = e.pageY;
}
if (isIE) {
_x = event.clientX + document.body.scrollLeft;
_y = event.clientY + document.body.scrollTop;
}
posX=_x;
posY=_y;
return true;
}
</script>
</head>
<body onclick=alert("X-position: "+posX+"; Y-position: "+posY+".")>
Click to track the mouse position.
</body>
</html>
Arie Molendijk.
Bookmarks