<!DOCTYPE html>
<html lang="zh-cmn-hans">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-salable=no, initial-scale=1.0; maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script>
window.onload = function(){
document.write("声明了显示浏览器的屏幕的宽度,以像素计:" + "<br>");
document.write("screen.width=" + screen.width + "<br>");
document.write("设置或返回一个窗口的外部高度与宽度,包括所有界面元素(如工具栏/滚动条):" + "<br>");
document.write("window.outerHeight=" + window.outerHeight + "<br>");
document.write("window.outerWidth=" + window.outerWidth + "<br>");
document.write("获取去除工具条与滚动条的窗口高度与宽度:" + "<br>");
document.write("window.innerHeight=" + window.innerHeight + "<br>");
document.write("window.innerWidth=" + window.innerWidth + "<br>");
}
</script>
</body>
</html>
测试screen.width, window.outerWidth, window.outerHeight, window.innerWidth, window.innerHeight
最新推荐文章于 2024-05-10 17:27:37 发布