代码如下:
<html> <head> <title>定时关闭网页_www.jb200.com</title> <script type="text/javascript"> var left = 5; function show() { var showtime = document.getElementById("showtime"); showtime.innerHTML = "此页面将在"+left + "秒后自动关闭页面" ; left--; if(left == 0) { window.opener=null; window.close(); } else { setTimeout("show()", 1000); } } </script> </head> <body onload="show()">//注意body里的onload属性 <center><div id="showtime"></div></center> </body> </html>
下面这个算是赠送的,哈哈,动态显示时间:
<html> <head> <title>动态显示时间_www.jb200.com</title> <script type="text/javascript"> var left = 5; function show() { var showtime = document.getElementById("showtime"); showtime.innerHTML = "此页面将在"+left + "秒后自动关闭页面" ; left--; if(left == 0) { window.opener=null; window.close(); } else { setTimeout("show()", 1000); } } </script> </head> <body onload="show()">//注意body里的onload属性 <center><div id="showtime"></div></center> </body> </html>