详解JavaScript编程中的window与window.screen对象
Window 对象 window.document.getElementById("header"); 与此相同: document.getElementById("header"); Window 尺寸
对于 Internet Explorer 8、7、6、5:
或者
实用的 JavaScript 方案(涵盖所有浏览器): 实例 var w=window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; var h=window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; 该例显示浏览器窗口的高度和宽度:(不包括工具栏/滚动条) Window Screen
实例 返回您的屏幕的可用宽度: <script> document.write("Available Width: " + screen.availWidth); </script> 以上代码输出为: Available Width: 1440 Window Screen 可用高度 <script> document.write("Available Height: " + screen.availHeight); </script> 以上代码将输出: Available Height: 860 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |