为什么我这个代码在chrome/ie/edge都正常,但粘贴到慕课这里面就会打开无数个新百度首页
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<title>setInterval_history</title>
<meta charset="UTF-8">
</head>
<body>
<span id="secondsBox">5</span>
<span>秒后回到主页</span>
<a href="" onclick="backWeb()">点击返回</a>
<!-- <input type="button" onclick="countBox()" value="点击计时"> -->
<script type="text/javascript">
var i=document.getElementById("secondsBox").innerHTML;
function countBox(){
if(i>1){
document.getElementById("secondsBox").innerHTML=i-1;
i--;
}
else if(i==1){
window.open("http://www.baidu.com","_blank");
clearInterval(sum);
}
}
var sum = setInterval(countBox, 1000);
function backWeb(){
window.history.back();
}
</script>
</body>
</html>