浏览器窗口的大小

			var w=window.innerWidth
			|| document.documentElement.clientWidth
			|| document.body.clientWidth;
			
			var h=window.innerHeight
			|| document.documentElement.clientHeight
			|| document.body.clientHeight;
			
			console.log(w+"   "+h);

  上边的代码是获得浏览器可视部分的高度和宽度.

			var dbsh=document.body.scrollHeight;
			console.log(dbsh);

  这里获得的是网页内容的实际内容的高度,比如如果一个网页很长,有滚动条,这时候dbsh的高度可能就比h代表的高度大很多.

原文地址:https://www.cnblogs.com/passer1991/p/3277357.html