function $($) {
    return document.getElementById($)
}
function $c(B, _, C, $) {
    var A = document.createElement(B);
    if (_) A.id = _;
    if (C) A.innerHTML = C;
    if ($) $.appendChild(A);
    return A
}
function $s(A, _) {
    $(A).style.display = _ ? "": "none"
}
function hit(_) {
    $(_).style.display = $(_).style.display == "block" ? "none": "block"
}
String.prototype.lenB = function() {
    return this.replace(/[^\x00-\xff]/g, "**").length
};
function gethtmlbody() {
    var $ = document.body.clientHeight,
    _ = document.documentElement.clientHeight,
    A = (_ <= $ && _ != 0) ? true: false;
    return A ? document.documentElement: document.body
}
function addEvent(A, $, _) {
    if (A.addEventListener) A.addEventListener($, _, true);
    else A.attachEvent("on" + $, _)
}
function getScreenSize() {
    var $ = 0,
    _ = 0;
    if (self.innerHeight) {
        $ = self.innerWidth;
        _ = self.innerHeight
    } else if (document.documentElement && document.documentElement.clientHeight) {
        $ = document.documentElement.clientWidth;
        _ = document.documentElement.clientHeight
    } else if (document.body) {
        $ = document.body.clientWidth;
        _ = document.body.clientHeight
    }
    return {
        w: $,
        h: _
    }
}
function ajaxProxy() {
    if (($("ajaxProxy") && $("ajaxProxy").contentWindow.pAjax)) return $("ajaxProxy").contentWindow.pAjax;
    return false
}
function jsLoader(C, B) {
    var _ = document.getElementsByTagName("head")[0],
    A = document.createElement("script");
    A.setAttribute("charset", "gb2312");
    A.setAttribute("type", "text/javascript");
    A.setAttribute("src", C);
    var $ = function(_) {
        var $ = (_ ? _: window.event).target ? (_ ? _: window.event).target: (_ ? _: window.event).srcElement;
        if ($ && ($.readyState == "loaded" || $.readyState == "complete")) {
            $.onreadystatechange = null;
            B()
        }
    };
    if (B) if (document.all) A.onreadystatechange = $;
    else A.onload = B;
    _.appendChild(A)
}
function setalpha(C, B, _, $) {
    if (!B) B = 10;
    if (!_) _ = 5;
    if (!$) $ = 10;
    if (navigator.userAgent.indexOf("MSIE") > 0) {
        C.style.filter = "alpha(opacity:100)";
        C.filters.alpha.opacity = B;
        var A = setInterval(function() {
            C.filters.alpha.opacity += _;
            if (C.filters.alpha.opacity >= 100) clearInterval(A)
        },
        $)
    }
}
function addfavorite(_, $) {
    _ = _ || document.title;
    $ = $ || document.location.href;
    if (document.all) window.external.addFavorite($, _);
    else if (window.sidebar) window.sidebar.addPanel(_, $, "")
}
function addcss(A) {
    try {
        var _ = document.createStyleSheet();
        _.cssText = A
    } catch($) {
        _ = document.createElement("style");
        _.type = "text/css";
        _.textContent = A;
        document.getElementsByTagName("HEAD").item(0).appendChild(_)
    }
}
function swapNode(B, C) {
    var A = B.parentNode,
    D = C.parentNode,
    _ = B.nextSibling,
    $ = C.nextSibling;
    if (_) A.insertBefore(C, _);
    else A.appendChild(C);
    if ($) D.insertBefore(B, $);
    else D.appendChild(B)
}
var Site = new Object();
Site.Cookie = {
    _expires: 24 * 3600 * 1000,
    _domain: "www.xxxx.com",
    set: function(_, C, $, B, A) {
        $ = new Date(new Date().getTime() + ($ ? $: this._expires));
        document.cookie = _ + "=" + escape(C) + "; expires=" + $.toGMTString() + "; path=" + (B ? B: "/") + "; domain=" + (A ? A: this._domain)
    },
    get: function(_) {
        var $ = document.cookie.match(new RegExp("(^| )" + _ + "=([^;]*)(;|$)"));
        if ($ != null) return unescape($[2]);
        return null
    },
    clear: function($, A, _) {
        if (this.get($)) document.cookie = $ + "=; path=" + (A ? A: "/") + "; domain=" + (_ ? _: this._domain) + "; expires=Fri, 02-Jan-1970 00:00:00 GMT"
    }
};
Site.Net = {
    init: function() {
        if (!$("nets")) return;
        var _ = $("nets").getElementsByTagName("div");
        for (var A in _) this.s(_[A]);
        $("nets").parentNode.removeChild($("nets"))
    },
    s: function(_) {
        if (typeof(_) == "undefined") return;
        _ = _.id;
        if (!_ || !$(_ + "_p")) return;
        swapNode($(_), $(_ + "_p"))
    }
};
function killErrors() {
    return true
}
document.domain = "www.xxxx.com";
window.onerror = killErrors;
if (Site.Cookie.get("upgameinfo") != 1) addcss(".gameinfo{position:absolute;left:0;top:-999px}");
var marTime = new Array();
var marWay = new Array();
var moveTime = new Array();
moveTime[0] = 0;
moveTime[1] = 0;
var speed = 30;
var fodTime = 0;
var proFlog = 0;
var proTime = 0;
function setdefSkin() {
    var n = Site.Cookie.get("skin");
    if (n != null) {
        var m = Site.Cookie.get("skin_def");
        if (!m) {
            setSkin(0);
            Site.Cookie.set("skin_def", "true");
        } else {
            setSkin(n);
        }
    } else {
        Site.Cookie.set("skin_def", "true");
    }
}
var cssList = new Array("css/global.css", "css/style_orange.css", "css/style_blue.css", "css/style_purple.css", "c/global.css", "c/style_orange.css", "c/style_blue.css", "c/global.css", "c/style_orange.css", "c/style_blue.css");
function setSkin(n) {
    var css = $("cssChange");
    var cssurl = "http://www.xxxx.com/skin/";
    cssurl += cssList[n];
    css.href = cssurl;
    Site.Cookie.set("skin", n);
}
function formatSkin() {
    var p = $("SkinList").getElementsByTagName("li");
    var s = $("sar");
    for (i = 0; i < p.length; i++) {
        p[i].num = i;
        p[i].onclick = function() {
            setSkin(this.num);
        }
    }
    s.onclick = function() {
        openSkin("sar", "SkinList", 140, 56, 2, 0);
    };
}
function _openSkin(o1, o2, max, min, speed, n) {
    return openSkin(o1, o2, max, min, speed, n);
}
function _closeSkin(o1, o2, max, min, speed, n) {
    return closeSkin(o1, o2, max, min, speed, n);
}
function openSkin(o1, o2, max, min, speed, n) {
    var a = $(o1);
    var s = $(o2);
    var w = s.offsetWidth;
    var move = function() {
        w += speed;
        if (w >= max) {
            w = max;
            s.style.width = w + "px";
            if (moveTime[n]) {
                window.clearInterval(moveTime[n]);
            }
            if (n) {
                $("pro_arrow").className = "al";
                $("pro_arrow").onclick = function() {
                    closeSkin(o1, o2, max, min, speed, n);
                }
            } else {
                a.innerHTML = "<div class='s'><img src='/n/i/space.gif' alt='收缩' /></div>";
                a.onclick = function() {
                    closeSkin(o1, o2, max, min, speed, n);
                }
            }
        } else {
            s.style.width = w + "px";
            if (n) {} else {
                s.style.display = "block";
            };
        }
    };
    moveTime[n] = window.setInterval(move, 5);
}
function closeSkin(o1, o2, max, min, speed, n) {
    var a = $(o1);
    var s = $(o2);
    var w = s.offsetWidth;
    var move = function() {
        w -= speed;
        if (w <= min) {
            w = min;
            s.style.width = w + "px";
            if (n) {
                $("pro_arrow").className = "ar";
                $("pro_arrow").onclick = function() {
                    openSkin(o1, o2, max, min, speed, n);
                };
            } else {
                a.innerHTML = "<div><img src='/n/i/space.gif' alt='更多皮肤' /></div>";
                a.onclick = function() {
                    openSkin(o1, o2, max, min, speed, n);
                }
            };
            if (moveTime[n]) {
                window.clearInterval(moveTime[n]);
            }
        } else {
            s.style.display = "block";
            s.style.width = w + "px";
        };
    };
    moveTime[n] = window.setInterval(move, 5);
}

解决方案 »

  1.   

    <script>里加上defer="defer" 试试
      

  2.   

    <script defer="defer"></script>
      

  3.   

    加了以后,ie6的错误没啦,但是好像下面的js不起作用了
      

  4.   

    把需要加载后执行的js放到外面 重新包个<script></script>
      

  5.   

    下面的<script>XXX.js</script>不执行了,那个区域现在是空白的了
      

  6.   

    这个是提供性能用的,你IE之所以会失败是因为IE6太老了,而你的这段JS做的事太多了,浏览器扛不住defer是不立即执行的。但是在你这个例子里只是用来test,不能这样,你如果需要兼容IE6.需要重新写JS了
      

  7.   

    <script>里加上defer="defer" 我是这么做的 虽然解决了 但是不知道是不是这个原因!