我用document.body.offsetHeight是IE可以得可视区域的高度。
可是在FIREFOX下就不行,它好像得的是整个网页的高度了,, 
在FIREFOX下如何获得呢。。 

解决方案 »

  1.   

    function getDocumentBounds() {
        if (document.documentElement && document.compatMode == "CSS1Compat") {
            return {
                st: document.documentElement.scrollTop,
                sl: document.documentElement.scrollLeft,
                sw: document.documentElement.scrollWidth,
                sh: document.documentElement.scrollHeight,
                cw: document.documentElement.clientWidth,
                ch: document.documentElement.clientHeight
            }
        } else if (document.body) {
            return {
                st: document.body.scrollTop,
                sl: document.body.scrollLeft,
                sw: document.body.scrollWidth,
                sh: document.body.scrollHeight,
                cw: document.body.clientWidth,
                ch: document.body.clientHeight
            }
        }
    }
      

  2.   

    <script>
    function getViewportHeight() {
        var height = 0;
        if (window.innerHeight) {
            height = window.innerHeight;
        } else if (document.documentElement && document.documentElement.clientHeight) {
            height = document.documentElement.clientHeight;
        } else if (document.body && document.body.clientHeight) {
            height = document.body.clientHeight;
        }
        return height;}
    </script>