(function(){ var loadUrl = 'http://www.cnblogs.com/naokr/',//跳转链接 loadTime = 3000,//跳转时间 reTime = 1000; reIn = setInterval(showTxt,reTime); function showTxt(){ if(loadTime > reTime){ loadTime = loadTime - reTime; document.getElementById('tsnid').innerHTML = parseInt(loadTime/reTime); }else{ window.location = loadUrl; } } }());