function countdown() { var time = 70; // time in seconds var timer;

function startTimer() { timer = setInterval(function () { if (time > 0) { time--; var minutes = Math.floor(time / 60); var seconds = time % 60; $('.clock').text(minutes + ':' + (seconds < 10 ? '0' : '') + seconds); } else { clearInterval(timer); // trigger event here } }, 1000); // set interval to 1 second (1000 milliseconds) }

startTimer(); }

function countdown 	var time = 70; time in secondsvar timer;		 if time 0 time--; var minutes = Mathfloortime 60; var seconds = time 60; $clocktextminutes + + secon

原文地址: http://www.cveoy.top/t/topic/iSpZ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录