日期:2014-05-16  浏览次数:20331 次

javascript倒计时跳转


<html>
<head>
<script language="JavaScript1.2" type="text/javascript"> 
function delayURL(url) {
    var delay = document.getElementById("time").innerHTML;
    //alert(delay);

    if(delay > 0){
        delay--;
        document.getElementById("time").innerHTML = delay;
    } else {
        window.top.location.href = url;
    }
    setTimeout("delayURL('" + url + "')", 1000);
}
</script>
</head>

<body>
<span id="time" style="background:cyan">5</span>秒钟后自动跳转到 > <a href="article.jsp">主题帖</a>

<script language="JavaScript1.2" type="text/javascript">
delayURL("article.jsp");
</script>
</body>
</html>



转载