JS get the mouse coordinates, get the typical example of the mouse pixel, run this page, move the mouse at will, the location of the mouse can be displayed in due time, do not occupy the system resources.
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <title>javascript get mouse coordinates </title> <meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/> <style type=" Text/css "> Tip {width:200px; border:2px solid #ddd; padding:8px; Background: #f1f1f1; Color: #666; } </style> <script type= "Text/javascript" > Function Mousepos (e) {var x,y; var e = e| | window.event; return {x:e.clientx+document.body.scrollleft+document.documentelement.scrollleft, y:e.clienty+ Document.body.scrolltop+document.documentelement.scrolltop}; }; function Test (e) {document.getElementById ("MJs"). InnerHTML = Mousepos (e). x+ ', ' +mousepos (e). Y; }; </script> </pead> <body> <div id= "MJS" class= "tip" > Source enthusiasts </div> <div id= "test" onmous Emove= "Test (event)" ></div> </body></ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]