Posted in Javascript onFebruary 14, 2017
本文实例讲述了JavaScript实现定时页面跳转功能。分享给大家供大家参考,具体如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Test</title> <script type="text/javascript" language="javascript" > <!-- var time = 8; //时间,秒 function Redirect(){ window.location = "https://3water.com/"; } var i = 0; function dis(){ document.all.s.innerHTML = "还剩" + (time - i) + "秒"; i++; } timer=setInterval('dis()', 1000);//显示时间 timer=setTimeout('Redirect()',time * 1000); //跳转 //--> </script> </head> <body> <span id="s"></span> </body> </html>
希望本文所述对大家JavaScript程序设计有所帮助。
JavaScript实现定时页面跳转功能示例
- Author -
风起从容声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@