Home > Web Front-end > JS Tutorial > body text

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

WBOY
Release: 2016-05-16 16:43:31
Original
1194 people have browsed it

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();
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!