自己写的jquery倒计时
function fresh(t) { var RemainTime = t.val(); var endtimeStr = RemainTime.replace(/-/g,"/"); var endtime=new Date(endtimeStr); var nowtime = new Date(); var leftsecond=parseInt((endtime.getTime()-nowtime.getTime())/1000); d=parseInt(leftsecond/3600/24); h=parseInt((leftsecond/3600)%24); m=parseInt((leftsecond/60)%60); s=parseInt(leftsecond%60); t.parents(".joinTo").find("[myname=lastTime]").html("剩余时间:<b>"+d+"</b> 天 <b>"+h+"</b> 时 <b>"+m+"</b> 分 <b>"+s+"</b> 秒 "); if(leftsecond<=0){ t.parents(".joinTo").find("[myname=lastTime]").html("<b>抢购已结束</b>"); clearInterval(sh); } } var sh; sh=setInterval(function(){ $("input[name=time]").each(function() { fresh($(this)); }); },1000);
相关推荐
85443563 2018-12-07
thomas0yang 2019-06-28
xian 2016-11-10
小丫00 2013-12-21
Raindan 2012-11-13
GUAOSHITAIDU 2011-07-12
rou 2011-04-27
夜光寒 2016-12-30
theRoom 2015-03-16
wangchunbo空间 2015-04-14
卜小娴 2015-03-11
mzoy 2016-05-26
luantianjiao 2016-04-12
mjx00 2016-02-05
86590891 2019-04-24
88417615 2019-04-18
somboy 2011-10-23