1. 如果打开该页面后,如果不做任何操作则5秒后自动跳转到一个新的地址
2. 如果点击“返回”按钮则返回前一个页面。
<!DOCTYPE html>
<html>
<head>
<title>浏览器对象</title>
<meta http-equiv="Content-Type" content="text/html; charset=gkb"/>
</head>
<body>
<div>
<h2>操作成功</h2>
<p><span id="seconds" style="font-weight: bold">5</span>秒后自动跳到主页<a href="javascript:window.history.go(-1)">返回</a></p>
</div>
<script type="text/javascript">
window.οnlοad=function(){
var seconds = document.getElementById("seconds").innerHTML;
var timerP = setInterval(function(){
seconds--;
document.getElementById("seconds").innerHTML=seconds;
if(seconds==0){
location.href="https://www.baidu.com/";
}
},1000);
};
</script>
</body>
</html>