IE8 SCRIPT87:参数无效。

时间:2014-09-26 17:57:48

标签: javascript internet-explorer-8 styles loader

所以我有一个典型的烦人而没有解释IE8错误。它写了#34; Script87:无效的参数"。 这是代码:

    var loaded = false;
    function loader(wrapperId) {
        var Loader = document.createElement("div");
        var image = document.createElement("img");
        image.src = "../scripts/loader/1.gif";


        Loader.style.marginTop = ((window.innerHeight / 2) - image.height) + 5 + "px";
        //error appears right here. ^

        Loader.style.marginLeft = ((window.innerWidth / 2) - (image.width)) + 5 + "px";
        Loader.style.display = "block";


        Loader.id = "loader";
        Loader.appendChild(image);
        document.body.appendChild(Loader);


        var imLoading = setInterval(function () {
            if (loaded == true) {
                var containerLoader = document.getElementById(wrapperId);
                var loaderDivBar = document.getElementById(Loader.id);
                loaderDivBar.innerHTML = "";
                containerLoader.style.visibility = "visible";
                document.body.removeChild(loaderDivBar);
                document.body.overflow = "visible";
                clearInterval(imLoading);
            }
        }, 50);
        //place this call behind body object.
    }

现在,它在一切都很好用,但IE8。 所以这是它将错误吐出的部分:

Loader.style.marginTop = ((window.innerHeight / 2) - image.height) + 5 + "px";

0 个答案:

没有答案