<!DOCTYPE?html>
<html>
?<head>
??<title>瀏覽器對象</title>??
??<meta?http-equiv="Content-Type"?content="text/html;?charset=gkb"/>???
?</head>
?<body>
??<!--先編寫好網頁布局-->
??<!--先編寫好網頁布局-->
??<h3>操作成功</h3>
??<p><span?id="times">5</span>秒后回到主頁 </p>
<button?onclick="goback()">返回</button>
??<script?type="text/javascript">??
?
???//獲取顯示秒數的元素,通過定時器來更改秒數。
???//通過window的location和history對象來控制網頁的跳轉。
???
??????var?times?=?document.getElementById("times");
????var?i?=?5;
????var?timer?=?setInterval(function(){
???????
????????if(times.innerHTML?==?0){
????????????window.location.href="http://www.xianlaiwan.cn/";
????????}
????????else{
?????????????i--;
?????????????times.innerHTML?=?i;
????????}
????????
????},1000);
???
???
???
???function?goback(){
???????window.history.back();
???}
???
???
???
?</script>?
</body>
</html>
2019-04-05
厲害厲害!