读书人

记时10秒后关闭当前窗口

发布时间: 2012-10-28 09:54:44 作者: rapoo

倒计时10秒后关闭当前窗口

<script type="text/javascript">var time=10;function closeWindow(){window.setTimeout('closeWindow()',1000);if(time>0){document.getElementById("show").innerHTML=" 倒计时<font color=red>"+time+"</font>秒后关闭当前窗口";time--;}else{window.opener=null; //关闭窗口时不出现提示窗口window.close();}}</script><body onload="closeWindow();"><div id="show">倒计时10秒后关闭当前窗口</div>

?

读书人网 >Web前端

热点推荐