<!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.xianlaiwan.cn"; //獲取顯示秒數的元素,通過定時器來更改秒數。 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
提交
取消
2022-03-23
老版本的應該是沒有的頂,學習的好認真啊。
2014-08-12
ok,挺棒的