Screen
对象包含有关客户端显示屏幕的信息。
属性
|
说明
|
availHeight
|
返回屏幕的高度(不包括
Windows
任务栏)
|
availWidth
|
返回屏幕的宽度(不包括
Windows
任务栏)
|
colorDepth
|
返回目标设备或缓冲器上的调色板的比特深度
|
height
|
返回屏幕的总高度
|
pixelDepth
|
返回屏幕的颜色分辨率(每像素的位数)
|
width
|
返回屏幕的总宽度
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
console.log("不包含任务栏的屏幕高度:" + screen.availHeight);
console.log("不包含任务栏的屏幕宽度:" + screen.availWidth);
console.log("屏幕高度:" + screen.height);
console.log("屏幕宽度:" + screen.width);
</script>
</body>
</html>