JavaScript Window Screen

Javascript 教程 · 2019-03-03 08:41:59

window.screen 对象包含有关用户屏幕的信息。

Window Screen

window.screen对象在编写时可以不使用 window 这个前缀。

一些属性:

  • screen.availWidth - 可用的屏幕宽度
  • screen.availHeight - 可用的屏幕高度

Window Screen 可用宽度

screen.availWidth 属性返回访问者屏幕的宽度,以像素计,减去界面特性,比如窗口任务栏。

实例

返回您的屏幕的可用宽度:

<script>
document.write("可用宽度: " + screen.availWidth);
</script>

以上代码输出为:

可用宽度: 1280

Window Screen 可用高度

screen.availHeight 属性返回访问者屏幕的高度,以像素计,减去界面特性,比如窗口任务栏。

实例

返回您的屏幕的可用高度:

<script>

document.write("可用高度: " + screen.availHeight);

</script>

以上代码将输出:

可用高度: 720

点击查看所有 Javascript 教程 文章: https://www.codercto.com/courses/l/27.html

查看所有标签

Flow-Based Programming (2nd Edition)

Flow-Based Programming (2nd Edition)

CreateSpace / 2010-5-14 / $69.95

Written by a pioneer in the field, this is a thorough guide to the cost- and time-saving advantages of Flow-Based Programming. It explains the theoretical underpinnings and application of this program......一起来看看 《Flow-Based Programming (2nd Edition)》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

URL 编码/解码
URL 编码/解码

URL 编码/解码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具