objek skrin

skrin

objek skrin mewakili maklumat skrin yang biasa digunakan ialah:

skrin.lebar: lebar skrin, dalam piksel; dalam piksel;

screen.colorDepth: Mengembalikan bilangan digit warna, seperti 8, 16, 24.

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

Meneruskan pembelajaran
||
<!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>
  • Cadangan kursus
  • Muat turun perisian kursus