objet d'écran

screen

l'objet screen représente les informations sur l'écran. Les attributs couramment utilisés sont :

screen.width : largeur de l'écran, en pixels ;

screen.height : hauteur de l'écran, en pixels ;

screen.colorDepth : renvoie le nombre de chiffres de couleur, par exemple 8, 16, 24.

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


Formation continue
||
<!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>
soumettreRéinitialiser le code
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!