一个简单的推断抢购时间是否到达的js函数

原型函数,功能非常easy,找到时钟的id,计算数值。到达抢购时间时运行任务。


function nwt() {var str=$('#deal_expiry_timer_e3cdcd2a').text(); 
var out=str.match(/d+/g);console.log(out);
var h=parseInt(out[0]),m=parseInt(out[1]),s=parseInt(out[2]);
console.log(h+'#'+m+'#'+s);var calc=h*3600+m*60+s;console.log(calc);
if(calc==0){} else {console.log('wait');}
 var t=setTimeout('nwt()',2000);}
nwt();




原文地址:https://www.cnblogs.com/gcczhongduan/p/5206881.html