You are here: irt.org | FAQ | JavaScript | Pointer | Q232 [ previous next ]
In Netscape Navigator 4 and Internet Explorer 4 you can use the following code:
<HTML> <HEAD> <SCRIPT LANGUAGE="JavaScript"><!-- if (navigator.appName == 'Netscape') { document.captureEvents(Event.MOUSEMOVE); document.onmousemove = netscapeMouseMove; } function netscapeMouseMove(e) { if (e.screenX != document.test.x.value || e.screenY != document.test.y.value) { document.test.x.value = e.screenX; document.test.y.value = e.screenY; } } function microsoftMouseMove() { if (window.event.x != document.test.x.value || window.event.y != document.test.y.value) { document.test.x.value = window.event.x; document.test.y.value = window.event.y; } } //--></SCRIPT> </HEAD> <BODY onMousemove="microsoftMouseMove()"> <FORM NAME="test"> X: <INPUT TYPE="TEXT" NAME="x" SIZE="4"> Y: <INPUT TYPE="TEXT" NAME="y" SIZE="4"> </FORM> </BODY> </HTML>