JavaScript中screen对象的两个属性

Screen 对象

Screen 对象包含有关客户端显示屏幕的信息。

这里说一下今天用到的两个属性:availHeigth,availWidth

avaiHeigth返回显示屏幕的高度 (除 Windows 任务栏之外)。

语法:screen.availHeigth

实例:

<html>

<body>
<script type="text/javascript">
document.write("<p>Available Height: ")
document.write(screen.availHeight + "</p>")
</script>
</body>

</html>

availWidth:返回显示屏幕的宽度 (除 Windows 任务栏之外)。

语法screen.availWidth

实例

<html>

<body>
<script type="text/javascript">
document.write("<p>Available Width: ")
document.write(screen.availWidth + "</p>")
</script>
</body>

</html>
posted @ 2017-04-21 10:12  小猿同学  阅读(566)  评论(0编辑  收藏  举报