222222222

来源:互联网 发布:arttemplate 写js语法 编辑:程序博客网 时间:2024/06/04 22:46
var docEle = function () {
        return document.getElementById(arguments[0]) || false;
    }
    var _heights,__heights;
    var layer = (function () {
        return {
            Mask: function () {
                if (docEle("fullbg")) {
                    document.body.removeChild(docEle("fullbg"));
                }
                var fullbg = document.createElement("div");
                fullbg.setAttribute("id", "fullbg");
                fullbg.style.display = "block";
                var _scrollWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
                var _scrollHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
                fullbg.style.width = _scrollWidth + "px";
                fullbg.style.height = _scrollHeight + "px";
                document.body.appendChild(fullbg);
                this.Loading();

            },
            Iframe: function () {
                if (docEle("fullbg")) {
                    document.body.removeChild(docEle("fullbg"));
                }
                var fullbg = document.createElement("div");
                fullbg.setAttribute("id", "fullbg");
                fullbg.style.display = "block";
                var _scrollWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
                var _scrollHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
                fullbg.style.width = _scrollWidth + "px";
                fullbg.style.height = _scrollHeight + "px";
                document.body.appendChild(fullbg);
                if (docEle("popdiv")) {
                    document.body.removeChild(docEle("popdiv"));
                }
                var popdiv = document.createElement("div");
                popdiv.setAttribute("id", "popdiv");
                popdiv.style.width = arguments[1] + "px";
                popdiv.style.height = arguments[2] + "px";
                popdiv.innerHTML = arguments[0];
                document.body.appendChild(popdiv);
                this.setcenter("popdiv");
            },
            Loading: function () {
                if (docEle("Loading")) {
                    document.body.removeChild(docEle("Loading"));
                }
                var popdiv = document.createElement("div");
                popdiv.setAttribute("id", "Loading");
                popdiv.style.top = (document.documentElement.scrollTop + document.documentElement.clientHeight / 2 - 15) + "px";
                popdiv.style.left = (document.body.scrollLeft + document.body.clientWidth / 2 - 100) + "px";
                if (g == "0") {
                    popdiv.innerHTML = "页面加载中...";
                }
                else if (g == "1") {
                    popdiv.innerHTML = "頁面加載中...";
                }
                else if (g == "2") {
                    popdiv.innerHTML = "loading...";
                }
                document.body.appendChild(popdiv);
            },
            setcenter: function (objectId) {
                var bH = $(window).height();
                var bW = $(window).width();
                this._left = bW / 2 - (parseInt($("#" + objectId).width()) / 2);
                this._top = bH / 2 - (parseInt($("#" + objectId).height()) / 2);
                $("#" + objectId).css("left", this._left)
            .css("top", this._top)
            .css("position", "absolute");
            },
            Closelayer: function () {
                document.body.removeChild(docEle("fullbg"));
                document.body.removeChild(docEle("Loading"));
            },
            CloseIfram: function () {
                document.body.removeChild(docEle("fullbg"));
                document.body.removeChild(docEle("popdiv"));

               
            }
        }
    })();

0 0
原创粉丝点击