团购倒计时
时间:2011-03-15 来源:祥子。
$(function(){ var endtime=new Date("2011/3/16 16:53:00");// 结束日期 var thisTime=new Date($("#hftime").val());// 当前服务器时间 var nowtime =thisTime.getTime();// 服务器当前时间总的秒数 var leftsecond=0; var sh; // 倒计时 function _fresh() { nowtime=nowtime+1000;//间隔1秒,毫秒加1000 leftsecond=parseInt((endtime.getTime()-nowtime)/1000); __d=parseInt(leftsecond/3600/24)<=9?+"0"+parseInt(leftsecond/3600/24).toString():parseInt(leftsecond/3600/24); __h=parseInt((leftsecond/3600)%24)<=9?+"0"+parseInt((leftsecond/3600)%24).toString():parseInt((leftsecond/3600)%24); __m=parseInt((leftsecond/60)%60)<=9?+"0"+parseInt((leftsecond/60)%60).toString():parseInt((leftsecond/60)%60); __s=parseInt(leftsecond%60)<=9?+"0"+parseInt(leftsecond%60).toString():parseInt(leftsecond%60); $(".daojis span").html(""+__d+"天"+__h+"时"+__m+"分"+__s+"秒"); if(leftsecond<=0){ $(".daojis span").html("特价已结束"); clearInterval(sh); } } _fresh() sh=setInterval(_fresh,1000);// });//结束
相关阅读 更多 +