获取设备的物理像素 <script> // 以像素计,屏幕的大小 var screenWidth = window.screen.width; var screenHeight = window.screen.height; console.log('屏幕的宽度为' + screenWidth); console.log('屏幕的高度为' + screenHeight); </script>