Js 獲取屏幕坐標


<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script>
        function getScreen(e) {
            var x = e.screenX - e.clientX;
            var y = e.screenY - e.clientY;
            alert("X坐標:" + x + ",Y坐標:" + y);
        }
    </script>
</head>
<body>
    <input type="button" onclick="getScreen(event)" value="測試" />
</body>
</html>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM