倒數計時自動關閉視窗javascript

2008-02-16 11:06 am
plz give me 倒數計時自動關閉視窗javascript

回答 (2)

2008-02-19 8:06 pm
✔ 最佳答案
==================================================
< head>
< script language= "javascript " type= "text/javascript ">
function CountAndClose()
{
var e = document.getElementById( "counter ");
var cTicks = parseInt(e.innerHTML);
var timer = setInterval(function()
{
if( cTicks )
{
e.innerHTML = --cTicks;
}
else
{
clearInterval(timer);
window.close();
}
}, 1000);
}
< /script>
< /head>
==================================================
< body onload= "CountAndClose() ">
< div id= "counter ">3 </ div>
< /body>
2008-02-16 1:46 pm
well..all you need to do is use "Window.close()" method in your javascript


收錄日期: 2021-05-01 00:26:35
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20080216000051KK00515

檢視 Wayback Machine 備份