<!DOCTYPE html>
<html>
<head>
<title>浏览器对象</title>
<meta http-equiv="Content-Type" content="text/html; charset=gkb"/>
</head>
<body>
<!--先编写好网页布局-->
<h2>操作成功</h2>
<span id="clock">5</span>
<span>秒后回到主页</span>
<form>
<input type="button" value="返回" onclick="back()" >
</form>
<script type="text/javascript">
var time=5,seconds;
function clock()
{
time--;
document.getElementById('clock').innerHTML=time;
if(time==0)
{
location.assign("https://www.imooc.com");
}
}
setInterval(clock,1000);
function back()
{
history.back();
}
//获取显示秒数的元素,通过定时器来更改秒数。
//通过window的location和history对象来控制网页的跳转。
</script>
</body>
</html>
window.history.go(-1)
window.location.href = "https://www.imooc.com";