<div class="wait"><span>10:13:16</span><input type="button" name="" id="" value="暂停" /> </div>
<div class="wait"><span>10:12:14</span><input type="button" name="" id="" value="暂停" /></div>
<div class="wait"><span>11:13:56</span><input type="button" name="" id="" value="暂停" /></div>
<div class="wait"><span>16:56:14</span><input type="button" name="" id="" value="暂停" /></div>
<div class="wait"><span>10:23:23</span><input type="button" name="" id="" value="暂停" /></div>
$(function(event){
var waitlentgth = $('.wait').length;
var time=new Array();
var minute,second,millsecond=new Array();
$('.wait').each(function(index,data){
var timefalg=setInterval(function(){
time= $(data).text();
minute = time.split(':')[0];
second= time.split(':')[1];
millisecond = time.split(':')[2];
minflag= minute.length;
secflag=second.length;
millflag=millisecond.length;
if(millisecond>0){
millisecond--;
$('.wait:eq('+index+')').text(minute+":"+second+":"+millisecond);
}
else if(millisecond==0&&second>0){
second--;
millisecond=99;
$('.wait:eq('+index+')').text(minute+":"+second+":"+"0"+millisecond);
}
else if(second==0&&minute>0){
minute--;
second=60;
$('.wait:eq('+index+')').text(minute+":"+second+":"+millisecond);
}
if(millisecond.length<2){
$('.wait:eq('+index+')').text(minute+":"+second+":"+"0"+millisecond);
}
else if(second.length<2){
$('.wait:eq('+index+')').text(minute+":"+"0"+second+":"+millisecond);
}else if(minute.length<2){
$('.wait:eq('+index+')').text("0"+minute+":"+second+":"+millisecond);
}
else if(minute==0&&second==0&&millisecond==0){
$('.wait:eq('+index+')').text('正在揭晓...')
clearInterval(timefalg);
}
},10)
//实现单个的暂停功能
// $('.wait:eq('+index+') input').on('click',function(){
// clearInterval(timefalg)
// })
})
})