怎么获取浏览器的宽度

WBOY
Release: 2016-06-13 10:23:34
Original
1219 people have browsed it

如何获取浏览器的宽度
具体使用方法是怎样的?

------解决方案--------------------

JScript code
//JS调整页面高度document.getElementById("leftMenu").style.height=window.screen.availHeight;//菜单导航高度等于浏览器高度;document.getElementById("rightMessage").style.height=window.screen.availHeight;//右边信息高度等于浏览器高度;document.getElementById("leftMenu").style.height=document.getElementById("rightMessage").style.height;//使左右两边高度相等;//在div中使用高度百分比时,要设置div的父元素都是100%<br><font color="#e78608">------解决方案--------------------</font><br>HTML DOM innerheight、innerwidth 属性<br>只读属性,声明了窗口的文档显示区的高度和宽度,以像素计。<br>这里的宽度和高度不包括菜单栏、工具栏以及滚动条等的高度。<br>IE 不支持这些属性。它用 document.documentElement 或 ducument.body (与 IE 的版本相关)的 clientWidth 和 clientHeight 属性作为替代。<br><br><br>这些问题去问w3school都是有答案的,别懒,越懒错过的越多。<div class="clear">
                 
              
              
        
            </div>
Copy after login
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!