到4秒就不变了,求大神看下
<!DOCTYPE html>
<html>
<head>
<title>浏览器对象</title>
<meta http-equiv="Content-Type" content="text/html; charset=gkb"/>
</head>
<body>
<!--先编写好网页布局-->
<h4>操作成功</h4>
</br>
<a id="num">5</a>秒后返回主页
<a onclick="GoBack()"> 返回</a>
<script>
var num=document.getElementById('num').innerHTML;
function startCount() {
if(num > 1){
num--;
document.getElementById('num').innerHTML =num;}else{location.assign('http://www.imooc.com');}
}
setInterval(startCount(), 1000);
function GoBack() {
window.history.back();
}
</script>
</body>
</html>