您的位置:首页 > 其它

获取网页上的屏幕信息和鼠标坐标

2007-12-06 11:14 459 查看
<html>
<head>
<style type="text/css">
<!--
p { color: blue; font-size: 37px; font-family: impact }
-->
</style>
<title>Screen and Mouse position</title>
</head>

<script language="javascript">
function reportMove()
{
window.status = "X=" + window.event.x + " Y=" + window.event.y;
// window.status="X="+window.event.screenX+" Y="+window.event.screenY;
}
function reportScreen()
{
var s = "网页可见区域宽:"+ document.body.clientWidth;
s += "/r/n网页可见区域高:"+ document.body.clientHeight;
s += "/r/n网页正文全文宽:"+ document.body.scrollWidth;
s += "/r/n网页正文全文高:"+ document.body.scrollHeight;
s += "/r/n网页正文部分上:"+ window.screenTop;
s += "/r/n网页正文部分左:"+ window.screenLeft;
s += "/r/n屏幕分辨率的高:"+ window.screen.height;
s += "/r/n屏幕分辨率的宽:"+ window.screen.width;
s += "/r/n屏幕可用工作区高度:"+ window.screen.availHeight;
s += "/r/n屏幕可用工作区宽度:"+ window.screen.availWidth;
alert(s);
}
</script>

<body onmousemove="reportMove()" onmousedown="reportScreen()">
<p>
When you click you mouse,<br />Show you the Screen information</p>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: