Every line of 'javascript countdown timer hours minutes seconds' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
247 function countdown(sec, eid) { 248 document.getElementById(eid).innerHTML = sec; 249 if (sec > 0) { 250 setTimeout("countdown("+(sec-1)+", '"+eid+"')", 1000); 251 } else { 252 forwardto('index.tmpl') 253 } 254 }
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
1 (function countdown(remaining) { 2 if(remaining === 0) 3 location.reload(true); 4 else { 5 document.getElementById('countdown').innerHTML = 'Refresh in: ' + remaining + ' sec'; 6 setTimeout(function(){ countdown(remaining - 1); }, 1000); 7 } 8 })(120);
30 function Countdown_CountBack(secs) { 31 if (secs < 0) { 32 document.getElementById("Countdown_cntdwn").innerHTML = Countdown_FinishMessage; 33 return; 34 } 35 DisplayStr = Countdown_DisplayFormat.replace(/%%D%%/g, Countdown_calcage(secs,86400,100000)); 36 DisplayStr = DisplayStr.replace(/%%H%%/g, Countdown_calcage(secs,3600,24)); 37 DisplayStr = DisplayStr.replace(/%%M%%/g, Countdown_calcage(secs,60,60)); 38 DisplayStr = DisplayStr.replace(/%%S%%/g, Countdown_calcage(secs,1,60)); 39 40 document.getElementById("Countdown_cntdwn").innerHTML = DisplayStr; 41 if (Countdown_CountActive) 42 setTimeout("Countdown_CountBack(" + (secs+Countdown_CountStepper) + ")", Countdown_SetTimeOutPeriod); 43 }
219 function countDown() { 220 var remainSeconds = $("#remainSeconds").val(); 221 var timeout; 222 if (remainSeconds > 0) {//秒杀还没开始,倒计时 223 $("#buyButton").attr("disabled", true); 224 $("#miaoshaTip").html("秒杀倒计时:" + remainSeconds + "秒"); 225 timeout = setTimeout(function () { 226 $("#countDown").text(remainSeconds - 1); 227 $("#remainSeconds").val(remainSeconds - 1); 228 countDown(); 229 }, 1000); 230 } else if (remainSeconds == 0) {//秒杀进行中 231 $("#buyButton").attr("disabled", false); 232 if (timeout) { 233 clearTimeout(timeout); 234 } 235 $("#miaoshaTip").html("秒杀进行中"); 236 $("#verifyCodeImg").attr("src", "/miaosha/verifyCode?goodsId=" + $("#goodsId").val()); 237 $("#verifyCodeImg").show(); 238 $("#verifyCode").show(); 239 } else {//秒杀已经结束 240 $("#buyButton").attr("disabled", true); 241 $("#miaoshaTip").html("秒杀已经结束"); 242 $("#verifyCodeImg").hide(); 243 $("#verifyCode").hide(); 244 } 245 }