<!DOCTYPE?html>
<html>
?<head>
??<title>瀏覽器對(duì)象</title>??
??<meta?http-equiv="Content-Type"?content="text/html;?charset=gkb"/>???
?</head>
?<body>
??<!--先編寫好網(wǎng)頁(yè)布局-->
??<h4>操作成功</h4>
??<p>
??????<b?id="second">5</b>秒返回到主頁(yè)? <a?href="javascript:goBack();">返回</a>
??</p>
?
??<script?type="text/javascript">??
?
???//獲取顯示秒數(shù)的元素,通過(guò)定時(shí)器來(lái)更改秒數(shù)。
????var?seconder?=?document.getElementById("second").innerHTML;
???//通過(guò)window的location和history對(duì)象來(lái)控制網(wǎng)頁(yè)的跳轉(zhuǎn)。
???var?i?=?5
???var?timer=setInterval(function(){
???????i?--;
???????seconder?=?i;
???????if(i==1){
???????????window.location.;
???????}
???????},1000)
????function?goBack(){
????????window.history.go(-1);
????}???
?</script>?
</body>
</html>
2016-10-28
var?timer=setInterval(function(){
???????i?--;
???????seconder?=?i;
???????if(i==1){
???????????window.location.).innerHTML的功能。
還有,有了seconder就不需要i了