$(function (){function _fresh()
{
$(".fd30_time").each(function(){
var dayh=$(this).attr("dayh");
var endtime=new Date($(this).attr("endtime")); //用来判断是否显示天数的变量
var starttime=new Date($(this).attr("starttime")); //用来判断是否显示天数的变量
var nowtime = new Date();
var leftsecond=parseInt((endtime.getTime()-nowtime.getTime())/1000);
var rightsecond=parseInt((starttime.getTime()-nowtime.getTime())/1000);
__d=parseInt(leftsecond/3600/24);
__dy=__d<10?'0'+__d:__d;
__h=parseInt((leftsecond/3600)%24);
__m=parseInt((leftsecond/60)%60);
__s=parseInt(leftsecond%60);
var c=new Date();
var q=((c.getMilliseconds())%10);
$(this).html("剩余"+__d+"天"+__h+"时"+__m+"分"+__s+"."+q+"秒")
if(dayh==0){
$(this).html("剩余"+__dy+"天")
if(__d==0){ $(this).html("剩余"+__h+"时");}
if(__h==0){ $(this).html("剩余"+__m+"分");}
}
/* if(dayh==1){
$(this).html("剩余"+__d+"天"+__h+"时"+__m+"分"+__s+"秒")
}*/
if(dayh==1){ $(this).html(""+__d+"天"+__h+":"+__m+":"+__s+"") }
if(dayh==2){ $(this).html(""+__d+"天"+__h+"时"+__m+"分"+__s+"秒") }
//alert(leftsecond);
if(rightsecond>0){
$(this).html("团购即将开始..");
$(this).parent().parent().addClass("qg_table_start");
// clearInterval(sh);
}
if(leftsecond<=0){
$(this).html("已结束");
$(this).parent().parent().find(".groupbuy").html("团购已结束");
$(this).parent().parent().find(".groupbuy").attr("href","javascript:void(0);");
$(this).parent().parent().addClass("qg_table_end");
// clearInterval(sh);
}
})
}
_fresh()
var sh;
sh=setInterval(_fresh,100)})