Javascript IE兼容代码不工作

Javascript IE兼容代码不工作,javascript,internet-explorer,dom,Javascript,Internet Explorer,Dom,可能重复: 我做错了什么?(本应符合IE标准,但根本不起作用) 一旦我修复了它,我该怎么做才能使它符合IE标准?在以var scrolledtonum=( (ScrollTop中的S必须为小写) 此外:确保在触发文档的onload事件之前不会调用getheight(),否则document.body.offsetHeight可能不会返回正确的值。FYI,“到2004年IE4市场份额下降到1%以下”。这真的不是很有建设性。我现在应该这样做吗?或者这个问题就足够了吗?我希望您不要在这里重写jQue

可能重复:

我做错了什么?(本应符合IE标准,但根本不起作用)


一旦我修复了它,我该怎么做才能使它符合IE标准?

在以
var scrolledtonum=(

(ScrollTop中的S必须为小写)


此外:确保在触发文档的onload事件之前不会调用getheight(),否则
document.body.offsetHeight
可能不会返回正确的值。

FYI,“到2004年IE4市场份额下降到1%以下”。这真的不是很有建设性。我现在应该这样做吗?或者这个问题就足够了吗?我希望您不要在这里重写jQuery。这是一个类似的例子,还有其他方法可以进行更改。我应用了这些更改,
((t=document.documentElement)|(t=document.body.parentNode))&&typeof t.scrollTop==“number”?t:document.body)。scrollTop
返回为0。
function getheight() {

            var myWidth = 0,
        myHeight = 0;
         if (typeof (window.innerWidth) == 'number') {
                //Non-IE
                myWidth = window.innerWidth;
                myHeight = window.innerHeight;
            } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
                //IE 6+ in 'standards compliant mode'
                myWidth = document.documentElement.clientWidth;
                myHeight = document.documentElement.clientHeight;
            }
            var scrolledtonum = (((t = document.documentElement) || (t = document.body.parentNode)) && typeof t.ScrollTop == 'number' ? t : document.body).ScrollTop + myHeight + 2;
            alert(scrolledtonum);
            var heightofbody = document.body.offsetHeight;
            if (scrolledtonum >= heightofbody) {
                document.body.scrollTop = 0;
            }
        }

        window.onscroll = getheight; 

        function func() {
            window.document.body.scrollTop++;
        }

        window.document.onmouseover = function () {
            clearInterval(interval);
        };

        window.document.onmouseout = function () {
            interval = setInterval(func, 20);
        };

        var interval = setInterval(func, 20);
.ScrollTop + myHeight + 2;