js控制10秒后页面自动跳转

<!DOCTYPE html>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>10s Jump</title>

<style>

    #content {width:100%; margin:0px auto; height:720px; line-height:720px; font-family:"微软雅黑"; font-size:16px}

</style>

<script type="text/javascript">

function countDown(secs,tUrl) {

    var jumpTo = document.getElementById("jumpTo");

    jumpTo.innerHTML=secs; 

    if (--secs>0){

        setTimeout("countDown("+secs+",‘"+tUrl+"‘)",1000);

     }

    else{

        location.href=tUrl;

    }

</script>

</head>


<body>

<div id="content" align="center">

    <a href="http://www.baidu.com">点击继续访问</a> &nbsp; <span id="jumpTo">9</span>&Prime;

    <script type="text/javascript">countDown(9,"http://www.baidu.com");</script>

</div>

</body>

</html> 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。