<!DOCTYPE html>
<html>
 <head>
  <title>浏览器对象</title>  
  <meta http-equiv="Content-Type" content="text/html; charset=gkb"/>   
 </head>
 <body >
  <!--先编写好网页布局-->
  <h2 id="title">操作成功</h2>
   <h4 id="status"></h4>
 
  <script type="text/javascript">  
 var i = 5;
 var url = "http://www.imooc.com";
 //获取显示秒数的元素,通过定时器来更改秒数。
 function clock() {
     document.getElementById('status').innerHTML = i + "秒后返回到主页 <a href=" + url + ">返回</a>";
 	i = i - 1;
 	var go = setTimeout("clock()", 1000);
 	if (i < 0) {
 		clearTimeout(go);
 		//通过window的location和history对象来控制网页的跳转。
 		window.location.href = url;
 	}
 }
 clock();
 </script> 
  
</body>
</html> 
                            
                                    东安
                                    
                                
                            2014-08-12
2 回答
举报
0/150
	提交
		取消
	 
                             
                            