时间:2021-07-01 10:21:17 帮助过:22人阅读
<html>
<head>
<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>
</head>
<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>
</html>