Home >Web Front-end >JS Tutorial >A simple js function to determine whether the rush sale time has arrived_javascript skills

A simple js function to determine whether the rush sale time has arrived_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:43:311270browse

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();
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn