例如这次的,页面JS光标/鼠标坐标,你也许问着有什么用,百度统计中有个热点统计图,这下清楚明白了吧。
好了,上肉:
功能:获取光标的像素坐标
代码如下:
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>