逻辑应该没有错啊,为什么连秒数都没减
<!DOCTYPE html>
<html>
<head>
<title>浏览器对象</title>
<meta http-equiv="Content-Type" content="text/html; charset=gkb"/>
</head>
<body>
<h2>操作成功!</h2>
<p>
<b id = "countDown">3</b>秒后回到主页<a href="javascript:goBack();">返回</a>
</p>
<script type="text/javascript">
var seconds = document.getElementById("countDown");
var num = 3;
function jump(){
if(num>0){
num--;
seconds.innerHTML = num;
if(num == 1){
window.location.href="https://www.baidu.com";
}
}else{
clearInterval("jump()");
} }
setInterval("jump()",1000);
function goBack(){
window.history.back();
}
</script>
</body>
</html>