日期:2014-05-16  浏览次数:20388 次

怎么样去掉window.onload加载?
网站的头部幻灯,本用window.onload使全页面加载结束再加载,以加快全页面的整体载入速度。但是后来发现极大的影响了页面的美观和亲和力。希望能去掉window.onload,又不知道从何入手,望赐教

JScript code
<script type="text/javascript">
//<![CDATA[
    $('slideshow').style.display='none';
    $('wrapper').style.display='block';
    var slideshow=new TINY.slideshow("slideshow");
    window.onload=function(){
        slideshow.auto=true;
        slideshow.speed=5;
        slideshow.link="linkhover";
        slideshow.info="information";
        slideshow.thumbs="slider";
        slideshow.left="slideleft";
        slideshow.right="slideright";
        slideshow.scrollSpeed=4;
        slideshow.spacing=5;
        slideshow.active="#fff";
        slideshow.init("slideshow","image","imgprev","imgnext","imglink");
    }
    //]]>
</script>


外部JS文件代码为

JScript code
var TINY = {}; 
function $(i) {
    return document.getElementById(i)
}
function $$(e, p) {
    p = p || document;
    return p.getElementsByTagName(e)
}
TINY.slideshow = function(n) {
    this.infoSpeed = this.imgSpeed = this.speed = 10;
    this.thumbOpacity = this.navHover = 70;
    this.navOpacity = 25;
    this.scrollSpeed = 5;
    this.letterbox = '#000';
    this.n = n;
    this.c = 0;
    this.a = []
};
TINY.slideshow.prototype = {
    init: function(s, z, b, f, q) {
        s = $(s);
        var m = $$('li', s),
        i = 0,
        w = 0;
        this.l = m.length;
        this.q = $(q);
        this.f = $(z);
        this.r = $(this.info);
        this.o = parseInt(TINY.style.val(z, 'width'));
        if (this.thumbs) {
            var u = $(this.left),
            r = $(this.right);
            u.onmouseover = new Function('TINY.scroll.init("' + this.thumbs + '",-1,' + this.scrollSpeed + ')');
            u.onmouseout = r.onmouseout = new Function('TINY.scroll.cl("' + this.thumbs + '")');
            r.onmouseover = new Function('TINY.scroll.init("' + this.thumbs + '",1,' + this.scrollSpeed + ')');
            this.p = $(this.thumbs)
        }
        for (i; i < this.l; i++) {
            this.a[i] = {};
            var h = m[i],
            a = this.a[i];
            a.t = $$('h3', h)[0].innerHTML;
            a.d = $$('p', h)[0].innerHTML;
            a.l = $$('a', h)[0] ? $$('a', h)[0].href: '';
            a.p = $$('span', h)[0].innerHTML;
            if (this.thumbs) {
                var g = $