//广告基础类 function AD(w,h,pl,pt){ this.w=w;this.h=h;this.pl=pl;this.pt=pt; //存储样式代码 this.style=function(){}; //存储模板代码 this.tpl=function(){}; //存储js效果代码 this.script=function(){}; //存储广告数据 this.data=new Array(); // 存储广告的跳转链接 this.links=new Array(); //生成script标签,通过js传值,对每一条广告统计展示次数,只是展示次数,并非点击次数 this.statAD=function(id,spaceid,siteid) { var new_element = document.createElement("script"); new_element.type = "text/javascript"; new_element.src="http://fier8.com/index.php?m=poster&c=index&a=show&siteid="+siteid+"&spaceid="+spaceid+"&id="+id; document.body.appendChild(new_element); } this.init=function(pinfo){ var time=new Date().getTime(); for(var i in pinfo){ if((pinfo[i].startdate*1000 < time) && (pinfo[i].enddate * 1000 > time) && pinfo[i].disabled==0){//过滤未开始、过期、禁用的广告 this.statAD(pinfo[i].id,pinfo[i].spaceid,pinfo[i].siteid); this.data[pinfo[i].id]=pinfo[i]; } } } this.run=function(pinfo){ this.init(pinfo); document.write(this.style(this.w,this.h,this.pl,this.pt)); document.write(this.tpl(this.data)); this.script(jQuery); }; } var adSpace_11=new AD('100%','100%','px','px');//按广告版位生成对象 //样式 adSpace_11.style=function(w,h,pl,pt){ var style=''; return style; } //模板 adSpace_11.tpl=function(data){ var title='',url='',img='',alt='',url2='',img2='',alt2=''; var tpl='
'; tpl+='
'; return tpl; } //脚本 adSpace_11.script=function($){ //自己填入脚本逻辑 }; adSpace_11.run([{"id":"15","siteid":"1","name":"\u5409\u6797\u4e91\u5929\u53163","spaceid":"11","type":"images","setting":{"1":{"linkurl":"","imageurl":"http:\/\/fier8.com\/uploadfile\/2015\/0615\/20150615100914261.jpg","alt":"","url":"#"},"2":{"linkurl":"","imageurl":"http:\/\/fier8.com\/uploadfile\/2015\/0615\/20150615101138286.png","alt":"","url":"#"}},"startdate":"1430708106","enddate":"2252285700","addtime":"1430708147","hits":"0","clicks":"0","listorder":"0","disabled":"0"},{"id":"13","siteid":"1","name":"\u4e91\u5929\u5316","spaceid":"11","type":"images","setting":{"1":{"linkurl":"","imageurl":"http:\/\/fier8.com\/uploadfile\/2015\/0602\/20150602020946651.jpg","alt":"","url":"#"},"2":{"linkurl":"","imageurl":"http:\/\/fier8.com\/uploadfile\/2015\/0612\/20150612102427224.png","alt":"","url":"#"}},"startdate":"1430033520","enddate":"4294967295","addtime":"1430206415","hits":"0","clicks":"0","listorder":"0","disabled":"0"},{"id":"11","siteid":"1","name":"\u5409\u6797\u4e91\u5929\u53161","spaceid":"11","type":"images","setting":{"1":{"linkurl":"","imageurl":"http:\/\/fier8.com\/uploadfile\/2015\/0504\/20150504105014103.jpg","alt":"","url":"#"},"2":{"linkurl":"","imageurl":"http:\/\/fier8.com\/uploadfile\/2015\/0507\/20150507094817857.png","alt":"","url":"#"}},"startdate":"1429512660","enddate":"4106098320","addtime":"1430204048","hits":"0","clicks":"0","listorder":"0","disabled":"0"}]);