JavaScript定时显示广告代码分享
这是一则定时显示广告的javascript代码,当然也可以定时显示某一区块内容,很实用。
代码如下:
functionstrToDate(str,ext){
if(str==null||str=='')return;
vararys=newArray();
arys=str.split('-');
varnewDate=newDate(arys[0],arys[1]-1,arys[2],9,0,0);
if(ext){
newDate=newDate(newDate.getTime()+1000*60*60*24);
}
returnnewDate;
}
functionshowit(str,start,end){
vardate=newDate();
varstart=strToDate(start);
varend=strToDate(end,false);
if(date>start&&datedocument.write(str);
}
}
调取:
showit('Yourads','2011-07-06','2011-07-18');
热门推荐
10 祝女儿简短祝福语大全
11 大学新年祝福语简短创意
12 元旦适合的祝福语简短
13 朋友出远门祝福语简短
14 初六简短的祝福语
15 祝男孩生日祝福语简短
16 同事调离的祝福语简短
17 拜年红包的祝福语简短
18 妈妈生日祝福语简短励志