//15秒倒計時
var start = 15;
var step = -1;
function count()
{
document.getElementById("DaoJiShi").innerHTML = start;
start += step;
if (start < 0)
start = 15;
setTimeout("count()", 1000);
}
window.onload = count;
這麼一個15秒倒計時的程序
如何在start = 0 的時候調用後台select()方法?
求指教。。
var timer=null;
var start = 15;
var step = -1;
function count()
{
document.getElementById("DaoJiShi").innerHTML = start;
start += step;
if(start==0)
{
if(timer!=null)
clearTimeout(timer);
select();
}
}
//加載事件執行
count();
timer=setTimeout("count()", 1000);