今天查看了下新浪的js代码,发现一个背投的广告类代码,不论是从学习角度还是使用角度都是不错的,但发现了一个问题,会被屏蔽的。
下面是具体的js类代码
/* 轮播背投类 RotatorPB v3.1 Update by Dakular2008-8-25 格式:new RotatorPB(广告数组) 说明:第一次访问随机出现,以后访问顺序轮播;自动过滤过期广告;cookie时间24小时;商业广告数量不足时不显示 */ 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; //过滤无效广告 for(var i=0; i ','').replace('','')); var end = RotatorPB.strToDate(rad[i][3].replace(' ','').replace(' ',''),true); if(this.date>start && this.date' 'ipt>'); return; }else if(bttype!='htm' && bttype!='tml'){ sinabturl = "http://d1.sina.com.cn/d1images/pb/pbv4.html?" bturl "${}" bttype "${}" btsrc; }else{ sinabturl = btsrc; } try{ aryADSeq.push("openWindowBack()"); }catch(e){ openWindowBack(); } if(this.ary[n][2]!=""){ //监测计数 var oImg = new Image(); oImg.src = this.ary[n][2]; } }; RotatorPB.id=1; RotatorPB.G=function (N){ var c=document.cookie.split("; "); for(var i=0;i
具体的调用代码:
上面的beitou.jpg是图片的地址,后面的是链接, 开始日期 结束日期什么的大家参考下就可以了。