Where is my mouse?
From Wikiid
Revision as of 18:33, 23 November 2007 by SteveBaker (Talk | contribs)
<form name="exf1">
Mouse X <input type="text" name="x" value="unknown">
Mouse Y <input type="text" name="y" value="unknown">
</form>
<script type=text/javascript>
var isIE = document.all?true:false;
if (!isIE) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = 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;
}
document.exf1.x.value=_x;
document.exf1.y.value=_y;
return true;
}
</script>