screen objectLOGIN

screen object

screen

The screen object represents screen information. Commonly used attributes are:

screen.width: screen width, in pixels;

screen.height: Screen height, in pixels;

screen.colorDepth: Returns the number of color digits, such as 8, 16, 24.

<html>
<head>
    <script>
        'use strict';
        alert('Screen size = ' + screen.width + ' x ' + screen.height);
    </script>
</head>
<body>
</body>
</html>
rrree


Next Section
<!DOCTYPE html> <html> <body> <h3>Your Screen:</h3> <script> document.write("窗口可以使用的屏幕宽高: "); document.write(window.screen.availWidth + "*" + screen.availHeight); document.write("<br>"); document.write("屏幕的宽高: "); document.write(screen.availWidth + "*" + window.screen.height); document.write("<br>"); document.write("用户浏览器表示的颜色位数: "); document.write(window.screen.colorDepth); document.write("<br>"); document.write("用户浏览器表示的颜色位数(ps:IE不支持?亲测好像支持唉): "); document.write(screen.pixelDepth); </script> <body> </body> </html>
submitReset Code
ChapterCourseware