有 2 种方法能够实现 html 的定时页面跳转,一、meta refresh 实现。二、JavaScript 实现。javascript
一、经过 meta refresh 实现 3 秒后自动跳转到 http://www.cnblogs.com/wuxibolgs329/ 页面。html
<!doctype html> <html> <head> <meta charset="utf-8"> <title>前端笔记</title> <meta http-equiv="refresh" content="3;url=http://www.cnblogs.com/wuxibolgs329/"> </head> <body> </body> </html>
二、经过 JavaScript 实现 8 秒后自动跳转到 http://www.cnblogs.com/wuxibolgs329/ 页面。前端
<!doctype html> <html> <head> <meta charset="utf-8"> <title></title> </head> <body> <span id="s"></span> <script type="text/javascript"> var s = document.getElementById('s'); var time = 8; //时间,秒 function Redirect() { window.location = "http://www.baidu.com/"; } var i = 0; function dis() { s.innerHTML = "还剩" + (time - i) + "秒"; i++; } timer = setInterval('dis()', 1000); //显示时间 timer = setTimeout('Redirect()', time * 1000); //跳转 </script> </body> </html>