Recently for the website development page statistics, although previously developed, but the function is not very complete, so this time to put some good features to use.
For example, this time, the page JS cursor/mouse coordinates, you may ask what use, Baidu statistics has a hot statistics map, this clearly understand it.
Okay, upper meat:
Function: Gets the pixel coordinates of the cursor
Copy Code code as follows:
<script type= "Text/javascript" >
function Showposition (e) {
var x,y;
var e = e| | window.event;
document.getElementById ("x"). Value = E.clientx+document.body.scrollleft+document.documentelement.scrollleft;
document.getElementById ("Y"). Value = E.clienty+document.body.scrolltop+document.documentelement.scrolltop
}
</script>
<body>
<div onmousemove= "Showposition" (event); "Style=" height:100%; width:100%; " >
X:<input id= "x" type= "text" value= "/>
Y:<input id= "y" type= "text" value= ""/>
</div>
</body>