<html>
<head>
<meta charset="utf-8"/>
</head>
<body>
<div id="div1" style="width:300px;height:300px;background-color:red" οnmοusemοve="cor(event)"></div>
<span id="span1"></span>
</body>
<script>
function cor(e){
//获得鼠标当前的坐标
//event代表事件对象(javascript内置的)
var x,y;
x = e.clientX;
y = e.clientY;
document.getElementById("span1").innerHTML = "X:"+x+",Y:"+y;
}
</script>
</html>