带倒计数的js页面跳转代码
作者:cnfgg 日期:2009-09-22
参数:毫秒、文本ID,跳转网址*/
function TimerUrl(ms,TextID,GoUrl)
{
var duration=ms;
var timer=null;
var endTime = new Date().getTime() + duration + 100;
function interval()
{
var n=(endTime-new Date().getTime())/1000;
if(n<0) return;
if(TextID && TextID!=""){document.getElementById(TextID).innerHTML = n.toFixed(3);}
setTimeout(interval, 10);
}
window.onload=function()
{
timer=setTimeout("window.location.href='"+GoUrl+"'",duration);
interval();
}
}
评论: 0 | 引用: 0 | 查看次数: -
发表评论
上一篇
下一篇

文章来自:
Tags:
相关日志: