<html>
<head>
<script type="text/javascript">
window.onload = init;
function init() {
if (window.Event) {
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousedown = getPosition;
}
function getPosition(e) {
xPos = (window.Event) ? e.pageX : event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
yPos = (window.Event) ? e.pageY : event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
alert("X: " + xPos + " Y: " + yPos);
}
</script>
</head>
<body>
</body>
</html>
- <html>
- <head>
- <script type="text/javascript">
-
- window.onload = init;
- function init() {
- if (window.Event) {
- document.captureEvents(Event.MOUSEMOVE);
- }
- document.onmousedown = getPosition;
- }
- function getPosition(e) {
- xPos = (window.Event) ? e.pageX : event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
- yPos = (window.Event) ? e.pageY : event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
-
- alert("X: " + xPos + " Y: " + yPos);
- }
-
- </script>
- </head>
- <body>
-
- </body>
- </html>
Tested in FF3.5 and IE7. This gets you the position, but there's a few different ways to go about persisting those values to a DB, so that depends on your needs. If you need it to be snappy, then you could wire up an ajax call to your favorite SS language and save it that way.
I'd love to change the world, but they won't give me the source code.