日期:2014-05-16  浏览次数:20348 次

获取当前鼠标的坐标 js
<html>
<head>
<meta charset="utf-8"/>
<script>
function a(ww){
var x,y;
x=ww.clientX;
y=ww.clientY;
document.getElementById('div2').innerHTML="X"+":"+x+","+"Y"+":"+y;

}

</script>
</head>
<body >
<div id="div1" style="width:120px;height:120px;background-Color:'red';"  onmousemove="a(event)"></div>
<span id="div2"></span>
</body>
</html>