<!DOCTYPE html>
<html>
<head>
<title>浏览器对象</title>
<meta http-equiv="Content-Type" content="text/html; charset=gkb"/>
</head>
<body>
<!--先编写好网页布局-->
<h1>操作成功</h1>
<strong id="counter">5</strong>秒后回到主页 
<a href="javascript:window.history.goBack();">返回</a>
<script type="text/javascript">
var tag = document.getElementById("counter");
var num = 5;
//获取显示秒数的元素,通过定时器来更改秒数。
var i = window.interval(function CutdownCounter(){
num--;
tag.innerHTML = num;
if(num <= 0)
{
clearInterval(i);
window.location.href="http://www.imooc.com";
}
}, 1000);
//通过window的location和history对象来控制网页的跳转。
</script>
</body>
</html>var i = window.interval(function CutdownCounter()
中 函数名可以省略,但是function绝对不能省略!!!!!