Home >Web Front-end >JS Tutorial >A simple js function to determine whether the rush sale time has arrived_javascript skills
Prototype function, the function is very simple, find the id of the clock, calculate the value, and execute the task when the rush time is reached.
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();