汇集软件下载,免费分享活动线报

获取网页中的各种长宽、坐标

微创网小编 0

获取网页中的各种长宽、坐标

<!doctype html>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<title>网页中的各种长宽、坐标</title>
</head>
</head>
<body onmousemove="getXandY()">
	<label>window.event.clientX:</label><label id="xa" class="xy"></label><br />
	<label>window.event.clientY:</label><label id="ya" class="xy"></label><br />
	<label>window.event.x		 :</label><label id="xb" class="xy"></label><br />
	<label>window.event.y		 :</label><label id="yb" class="xy"></label><br />
	<label>window.event.screenX:</label><label id="xc" class="xy"></label><br />
	<label>window.event.screenY:</label><label id="yc" class="xy"></label><br /><br />
	<label>window.screen.height:</label><label id="screenHeight" class="xy"></label><br />
	<label>window.screen.width:</label><label id="screenWidth" class="xy"></label><br /><br />
	<label>window.document.body.clientHeight:</label><label id="ch" class="xy"></label><br />
	<label>window.document.body.clientWidth:</label><label id="cw" class="xy"></label><br />
	<label>window.document.body.clientLeft:</label><label id="cl" class="xy"></label><br />
	<label>window.document.body.clientTop:</label><label id="ct" class="xy"></label><br /><br />
	<label>window.document.body.scrollHeight:</label><label id="sh" class="xy"></label><br />
	<label>window.document.body.scrollWidth:</label><label id="sw" class="xy"></label><br />
	<label>window.document.body.scrollLeft:</label><label id="sl" class="xy"></label><br />
	<label>window.document.body.scrollTop:</label><label id="st" class="xy"></label><br /><br />
	<label>window.document.body.offsetHeight:</label><label id="oh" class="xy"></label><br />
	<label>window.document.body.offsetWidth:</label><label id="ow" class="xy"></label><br />
	<label>window.document.body.offsetLeft:</label><label id="ol" class="xy"></label><br />
	<label>window.document.body.offsetTop:</label><label id="ot" class="xy"></label><br />
	<script type="text/javascript">
	function getXandY(){
		var Xa = window.event.clientX;
		var Ya = window.event.clientY;
		document.getElementById("xa").innerHTML = Xa;
		document.getElementById("ya").innerHTML = Ya;
		var Xb = window.event.x;
		var Yb = window.event.y;
		document.getElementById("xb").innerHTML = Xb;
		document.getElementById("yb").innerHTML = Yb;
		var Xc = window.event.screenX;
		var Yc = window.event.screenY;
		document.getElementById("xc").innerHTML = Xc;
		document.getElementById("yc").innerHTML = Yc;
		var screenHeight = window.screen.height;
		var screenWidth = window.screen.width;
		document.getElementById("screenHeight").innerHTML = screenHeight;
		document.getElementById("screenWidth").innerHTML = screenWidth;
		var clientHeight = window.document.body.clientHeight;
		var clientWidth = window.document.body.clientWidth;
		var clientLeft = window.document.body.clientLeft;
		var clientTop = window.document.body.clientTop;
		document.getElementById("ch").innerHTML = clientHeight;
		document.getElementById("cw").innerHTML = clientWidth;
		document.getElementById("cl").innerHTML = clientLeft;
		document.getElementById("ct").innerHTML = clientTop;
		var scrollHeight = window.document.body.scrollHeight;
		var scrollWidth = window.document.body.scrollWidth;
		var scrollLeft = window.document.body.scrollLeft;
		var scrollTop = window.document.body.scrollTop;
		document.getElementById("sh").innerHTML = scrollHeight;
		document.getElementById("sw").innerHTML = scrollWidth;
		document.getElementById("sl").innerHTML = scrollLeft;
		document.getElementById("st").innerHTML = scrollTop;
		var offsetHeight = window.document.body.offsetHeight;
		var offsetWidth = window.document.body.offsetWidth;
		var offsetLeft = window.document.body.offsetLeft;
		var offsetTop = window.document.body.offsetTop;
		document.getElementById("oh").innerHTML = offsetHeight;
		document.getElementById("ow").innerHTML = offsetWidth;
		document.getElementById("ol").innerHTML = offsetLeft;
		document.getElementById("ot").innerHTML = offsetTop;
	}
	</script>
</body>
</html>

标签:

暂无标签

免责声明:

本站提供的资源,都来自网络,版权争议与本站无关,所有内容及软件的文章仅限用于学习和研究目的。不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负,我们不保证内容的长久可用性,通过使用本站内容随之而来的风险与本站无关,您必须在下载后的24个小时之内,从您的电脑/手机中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。侵删请致信E-mail: 1270528312@qq.com

同类推荐
评论列表
签到