js实现倒计时



Web Page Design






//倒计时3秒,然后弹出Hello,word!
var timeleft =3;
var int=self.setInterval("passStart()",1000);
function passStart()
{
     console.log(timeleft)
    
          if(timeleft===-1){
             sayHello ();
          }else{
           document.getElementById('starttext').innerHTML='跳过('+timeleft+')';
           --timeleft;
          }
          
}
function sayHello(){
    alert("Hello,word!");
}

你可能感兴趣的:(js实现倒计时)