javascript实现倒计时N秒后网页自动跳转代码
<title>JS倒计时网页自动跳转代码</title>
<scriptlanguage="JavaScript"type="text/javascript">
functiondelayURL(url){
vardelay=document.getElementById("time").innerHTML;
if(delay>0){
delay--;
document.getElementById("time").innerHTML=delay;
}else{
window.top.location.href=url;
}
t=setTimeout("delayURL('"+url+"')",1000);
}
functionstop1(){ t&&clearTimeout(t); } </script> <spanid="time"style="background:#00BFFF">1000</span>秒钟后自动跳转,如果不跳转,请点击下面的链接<ahref="http://www.baidu.com">我的百度</a> <inputtype="button"value="停止跳转"onclick="stop1();"> <scripttype="text/javascript"> delayURL("http://www.baidu.com"); </script>