天易01----js实现定时关闭网页并动态显示时间

<html>

<head>

<title>title</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>

你可能感兴趣的:(function,null)