Capture mouse X - Y positions with this easy script. Works much like our Mouse Tracker script, but much simpler! Compatible in Internet Explorer and Netscape versions 4+.
Add the below code to the <body> section of your page:
<form
name="Show"> X <inputtype="text"name="MouseX"value="0"size="4"><br> Y <inputtype="text"name="MouseY"value="0"size="4"><br> </form> <scriptlanguage="javascript"type="text/javascript"> /* Visit http://www.yaldex.com/
for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin var
IE =document.all?true:false; if(!IE)document.captureEvents(Event.MOUSEMOVE) document.onmousemove=
getMouseXY; var
tempX =0; var
tempY =0; function
getMouseXY(e){ if(IE){// grab the x-y pos.s if browser
is IE tempX =event.clientX+document.body.scrollLeft; tempY =event.clientY+document.body.scrollTop;
} else{// grab the x-y pos.s if browser
is NS tempX =
e.pageX; tempY =
e.pageY;
} if(tempX
<0){tempX
=0;} if(tempY
<0){tempY
=0;} document.Show.MouseX.value=
tempX; document.Show.MouseY.value=
tempY; returntrue;
} // End --> </script>