欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

对联广告js flash激活

程序员文章站 2023-12-04 16:09:10
ad.js复制代码 代码如下:    var delta=0.08     var...

ad.js

复制代码 代码如下:

    var delta=0.08
    var collection;
    function floaters() {
        this.items    = [];
        this.additem    = function(id,x,y,content)
                  {
                    document.write('<div id='+id+' style="z-index: 10; position: absolute;  width:80px; height:60px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+'</div>');

                    var newitem                = {};
                    newitem.object            = document.getelementbyid(id);
                    newitem.x                = x;
                    newitem.y                = y;

                    this.items[this.items.length]        = newitem;
                  }
        this.play    = function()
                  {
                    collection                = this.items
                    setinterval('play()',10);
                  }
        }
        function play()
        {

            for(var i=0;i<collection.length;i++)
            {
                var followobj        = collection[i].object;
                var followobj_x        = (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);
                var followobj_y        = (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);

                if(followobj.offsetleft!=(document.body.scrollleft+followobj_x)) {
                    var dx=(document.body.scrollleft+followobj_x-followobj.offsetleft)*delta;
                    dx=(dx>0?1:-1)*math.ceil(math.abs(dx));
                    followobj.style.left=followobj.offsetleft+dx;
                    }

                if(followobj.offsettop!=(document.body.scrolltop+followobj_y)) {
                    var dy=(document.body.scrolltop+followobj_y-followobj.offsettop)*delta;
                    dy=(dy>0?1:-1)*math.ceil(math.abs(dy));
                    followobj.style.top=followobj.offsettop+dy;
                    }
                followobj.style.display    = '';
            }
        }    

    var thefloaters        = new floaters();
    //右面
    thefloaters.additem('followdiv1','document.body.clientwidth-106',80,'<embed src=images/duilian.swf quality=high  width=100 height=300 type=application/x-shockwave-flash id=ad wmode=opaque></embed>');
    //左面
    thefloaters.additem('followdiv2',6,80,'<embed src=images/duilian.swf quality=high  width=100 height=300 type=application/x-shockwave-flash id=ad wmode=opaque></embed>');
    thefloaters.play();

//图片格式调用方法
//<a href=http://www.makewing.com/lanren/ target=_blank><img src=images/ad_100x300.jpg border=0></a>