Home > Web Front-end > JS Tutorial > body text

javascript Sina pop-under advertising implementation code_advertising code

WBOY
Release: 2016-05-16 18:50:25
Original
1258 people have browsed it

I checked Sina's js code today and found a rear-projection advertising code, which is good from both a learning perspective and a usage perspective. However, I found a problem and it will be blocked.
The following is the specific js code

Copy the code The code is as follows:

/*
Carousel rear projection RotatorPB v3.1
Update by Dakular 2008-8-25
Format: new RotatorPB (Ad array)
Description: Randomly appear on the first visit, and rotate in order on subsequent visits; automatically filter out expired ads; cookie time is 24 hours; do not display when the number of commercial ads is insufficient
*/
if(typeof (RotatorPB)!='function'){
var RotatorPB=function (rad){
this.ary = new Array();
this.date = new Date();
this. w = rad.width;
this.h = rad.height;
this.num = rad.num;
this.o = rad.length;
this.id = RotatorPB.id;
this.m = 'rpb_' this.id;
this.n = new Array();
this.L = new Date();
this.e = 0;
var f;
var D = false;
var nn = 0;
//Filter invalid ads
for(var i=0; i var start = RotatorPB.strToDate(rad[i][2].replace('','').replace('',''));
    var end = RotatorPB. strToDate(rad[i][3].replace('','').replace('',''),true);
     if(this.date>start && this.date This.ary.push([rad[i][0], rad[i] [1], rad[i][4]]);
                                                                             ; 0;i                                                                                                   {
This.n[i]=g;
D=true;
this.n[i]=0;
                                                                                       (!D){
var r=Math.ceil(Math.random()*this.o);
var t=this.m '_' r;
RotatorPB.S(t,this .L.getTime(),1440);
this.e=r;
if(this.o==1){RotatorPB.S('s_dl',r,1440);}
/ /return r;
}else {
            var R=this.n.join(',').split(',');
            var k=R.sort();
            var max=Number(k[k.length-1]);
            var min=Number(k[0]);
            var F;
            for(var i=0;i                if(max==this.n[i]){
                    F=i 1;
                    break;
                }
            }
            if(typeof(F)!='undefined'){
                G=this.m '_' F;
                H=Number(RotatorPB.G(G));
                I=F%this.o 1;
                J=this.m '_' I;
                RotatorPB.S(J,this.L.getTime(),1440);
                if(this.o==1){
                    I=-RotatorPB.G('s_dl');
                    if(I==0){I=1;RotatorPB.S('s_dl',1,1440);}
                    RotatorPB.S('s_dl',I,1440);
                }
                this.e=I;
                //return I;
            }
        }
        //Show AD
        if(this.e==0 || this.ary.length==0) return; //如果没有广告则不显示
        if(this.e==-1) return; //当只有一个广告时:始终显示第一个/奇数次刷新显示
        var n = this.e-1;
        var btsrc = this.ary[n][0];
        var bturl = this.ary[n][1];
        var bttype = btsrc.substring(btsrc.length-3).toLowerCase();
        if(bttype=='.js'){ //js
            document.write('


上面的beitou.jpg是图片的地址,后面的是链接, 开始日期 结束日期什么的大家参考下就可以了。
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template