我想知道如何做到这一点,以便可以从当前时间增加或减少时间。例如减去或增加5秒。
var count = 1000;
var counter = setInterval(timer, 10); //10 will run it every 100th of a second
function timer()
{
if (count <= 0)
{
clearInterval(counter);
alert('De bom is ontploft. Kaboom!')
return;
}
count--;
document.getElementById("display").innerHTML=count / 100;
}