screen对象包含有关客户端显示屏幕的信息screen.availWidthscreen.availHeight// 获取屏幕的宽度 var screenWidth = window.screen.availWidth; console.log(screenWidth); // 获取屏幕的可视区 var viewWidth = document.body.clientWidth; console.log(viewWidth);