+ -
当前位置:首页 → 问答吧 → “定时更换超链接”出了问题,请大侠们帮助修改一下

“定时更换超链接”出了问题,请大侠们帮助修改一下

时间:2010-05-05

来源:互联网

问题:想实现以下三个超链接间隔7天(604800000毫秒)更换一个,顺序是:纯净——信任——理想,但是当传到网上时,并不是显示第一个“纯净”,而是7天后才开始从“纯净”循环。请大虾们帮助修改一下,从传到网上时刻开始进行第一个“纯净”循环,不要再等7天。
下面是js代码:
var speed=604800000
var news=new Array()
news[0]="<a href=gw001.htm'>纯净</a>"
news[1]="<a href=gw002.htm'>信任</a>"
news[2]="<a href=gw003.htm'>理想</a>"
i=0
function update(){
if (document.layers){
document.tickertape.document.subtickertape.document.write('<span

class="subtickertapefont">'+news[i]+'</span>')
document.tickertape.document.subtickertape.document.close()
}
else
document.all.subtickertape.innerHTML=news[i]

if (i<news.length-1)
i++
else
i=0
setTimeout("update()",speed)
}

function RunFader() {
var epct = step/inc;
var spct = 1 - epct;
if ( step < inc ) {
setTimeout('RunFader()',50);
}
step++;
}

作者: lijh0633   发布时间: 2010-05-05


<script type="text/javascript"> var d = Date.parse("May 4, 2010"); var n=new Date(); n=n.getTime(); var pastms=24*60*60*1000*7; var pos=Math.floor((n-d)/pastms); var news=[]; news[0]="<a href='gw001.htm'>纯净</a>"; news[1]="<a href='gw002.htm'>信任</a>"; news[2]="<a href='gw003.htm'>理想</a>"; pos%=news.length; document.write(news[pos]); </script>
 提示:您可以先修改部分代码再运行

作者: EraIT   发布时间: 2010-05-05

哥们,谢谢,你太牛了!厉害

作者: lijh0633   发布时间: 2010-05-06