js实时显示鼠标坐标

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>鼠标坐标随时变动</title>
</head>
<body>
<div id="event"></div>
<script type="text/javascript">
    var id = document.getElementById('event');
    document.addEventListener('mousemove',function(e){
        id.style.marginLeft = e.clientX + 'px';
        id.style.marginTop = e.clientY + 'px';
        id.innerHTML = "(X:" + e.clientX+",Y:"+e.clientY+ ")";
    });
</script>
</body>
</html>

上一篇:Temporary Post Used For Theme Detection (19f70e1d-5d8d-4c19-aef1-5b5a71ae0c47 - 3bfe001a-32de-4114-a6b4-4005b770f6d7)


下一篇:python核心编程正则表达式练习题1-2匹配由单个空格分隔的任意单词对,也就是性和名