不显示秒 求解决
<!DOCTYPE html>
<html>
<head>
<title>浏览器对象</title>
<meta http-equiv="Content-Type" content="text/html; charset=gkb"/>
</head>
<body>
<!--先编写好网页布局-->
<h2>
操作成功
</h2>
<p>
<span id='time'>5</span>
秒后回到主页
<a id="back" onclick="Back()">返回</a>
</p>
<script type="text/javascript">
var tim=document.getElementById('time')
var bac=document.getElementById("back")
var t=5
function Go(){
t--;
if(t<0){
tim.innerHTML=t
}else{
window.location.assign("https://www.imooc.com/")
clearTimeout(Go);
}
}
function Back(){
window.history.go(-1)
}
setInterval(Go,1000)
</script>
</body>
</html>