您的位置:首页 > Web前端 > JavaScript

Js 获取屏幕坐标

2014-03-02 00:07 302 查看
<!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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: