我想在光标移动时显示某个站点的坐标 x,y ..
我使用波纹管脚本,但它会生成一个警报框。
<script type=text/javascript>
var isIE = document.all?true:false;
if (!isIE) document.captureEvents(Event.CLICK);
document.onclick = getMousePosition;
function getMousePosition(e) {
var _x;
var _y;
if (!isIE) {
_x = e.pageX;
_y = e.pageY;
}
if (isIE) {
_x = event.clientX + document.body.scrollLeft;
_y = event.clientY + document.body.scrollTop;
}
posX = _x;
posY = _y;
return true;
}
</script>
<body onclick=alert("X-position: "+posX+"; Y-position: "+posY+".")>