定时刷新页面js函数。实现倒计时
function _fresh(){
var time=$("#time").val();var endtime=new Date(time);
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); //秒
var c=new Date();
var q=((c.getMilliseconds())%10);//毫秒
$("#remain_day").html( "<em>"+__d+"</em>"+"天 "+"<em>"+__h+"</em>"+"小时"+"<em>"+__m+"</em>"+"分"+"<em>"+__s+"</em>"+"秒");
if(leftsecond<=0){
$("#remain_day").html("抢购已结束");
clearInterval(sh);
}
}
_fresh() ;
var sh;
sh=setInterval(_fresh,1000);