---
title: "js获取屏幕大小"
author: "unixtux"
date: "2013-01-08T16:07:28Z"
tags: ["JavaScript"]
categories: ["Web前端"]
slug: "js"
draft: false
lastmod: "2013-01-08T16:08:15Z"
id: 1766322
url: "https://unixtux.iteye.com/blog/1766322"
---

```js

alert("网页可见区域宽： "+document.body.clientWidth);
alert("网页可见区域高： "+document.body.clientHeight);
alert("网页可见区域宽(包括边线的宽)： "+document.body.offsetWidth);
alert("网页可见区域高(包括边线的高)： "+document.body.offsetHeight);
alert("网页正文全文宽： "+document.body.scrollWidth);
alert("网页正文全文高： "+document.body.scrollHeight);
alert("网页被卷去的高： "+document.body.scrollTop);
alert("网页被卷去的左： "+document.body.scrollLeft);
alert("网页正文部分上： "+window.screenTop);
alert("网页正文部分左： "+window.screenLeft);
alert("屏幕分辨率的高： "+window.screen.height);
alert("屏幕分辨率的宽： "+window.screen.width);
alert("屏幕可用工作区高度： "+window.screen.availHeight);
alert("屏幕可用工作区宽度： "+window.screen.availWidth);

```