您的位置:首页 > 其它

团购限时抢购时间显示程序

2012-06-13 16:26 357 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>团购倒计时</title>

<script src=\'#\'" //liuxiaofan.com/demo/jquery-1.6.4.min.js" type="text/javascript"></script>

<script>

var endtimes=new Array();//结束时间

endtimes[0]="12/06/2011 9:03:00";

endtimes[1]="11/16/2011 9:24:20";

endtimes[2]="12/08/2011 9:05:00";

endtimes[3]="04/09/2011 9:15:00";

endtimes[4]="12/06/2011 6:03:00";

endtimes[5]="11/16/2011 3:04:20";

endtimes[6]="12/08/2011 2:05:00";

endtimes[7]="04/09/2012 5:05:00";

var nowtimes;

function givetime(){

nowtimes=new Date("11/07/2011 9:03:00");//当前服务器时间

DownCount();

};

function DownCount(){

nowtimes=Number(nowtimes)+1000;

for(var i=0;i<=7;i++)//设置一共有多少个商品

{

var theDay=new Date(endtimes[i]);

theDay=theDay++;

if(theDay<=nowtimes)

{

$(".times"+i).each(function(){$(this).find(".lxfTCD_day").text(00);$(this).find(".lxfTCD_hour").text(00);$(this).find(".lxfTCD_minute").text(00);$(this).find(".lxfTCD_second").text(00);});

}

else{

timechange(theDay,i);

};

};

window.setTimeout("DownCount()",1000);

};

function timechange(theDay,i){

var theDays=new Date(theDay);

var seconds = (theDays - nowtimes)/1000;

var minutes = Math.floor(seconds/60);

var hours = Math.floor(minutes/60);

var days = Math.floor(hours/24);

var CDay= days ;

var CHour= hours % 24;

var CMinute= minutes % 60;

var CSecond= seconds % 60;

if(CMinute<10) {CMinute="0"+CMinute;};

if(CHour<10) {CHour="0"+CHour;};

if(CSecond<10) {CSecond="0"+CSecond;} ;

$(".times"+i).each(function(){$(this).find(".lxfTCD_day").text(CDay);$(this).find(".lxfTCD_hour").text(CHour);$(this).find(".lxfTCD_minute").text(CMinute);$(this).find(".lxfTCD_second").text(CSecond);});

};

$(function(){

givetime();//执行函数

});

</script>

<style type="text/css">

<!--

* { font-style: normal; font-size:12px; color:#333}

span{ font-size:20px; font-weight:bold;}

-->

</style>

</head>

<body>

<div class="times0" >

<i>剩余时间:</i>

<span class="lxfTCD_day">10</span><em>天</em>

<span class="lxfTCD_hour">24</span><em>时</em>

<span class="lxfTCD_minute">35</span><em>分</em>

<span class="lxfTCD_second">01</span><em>秒</em>

</div>

<div class="times1" >

<i>剩余时间:</i>

<span class="lxfTCD_day">10</span><em>天</em>

<span class="lxfTCD_hour">24</span><em>时</em>

<span class="lxfTCD_minute">35</span><em>分</em>

<span class="lxfTCD_second">01</span><em>秒</em>

</div>

<div class="times2">

<i>剩余时间:</i>

<span class="lxfTCD_day">12</span><em>天</em>

<span class="lxfTCD_hour">12</span><em>时</em>

<span class="lxfTCD_minute">15</span><em>分</em>

<span class="lxfTCD_second">06</span><em>秒</em>

</div>

<div class="times3">

<i>剩余时间:</i>

<span class="lxfTCD_day">10</span><em>天</em>

<span class="lxfTCD_hour">08</span><em>时</em>

<span class="lxfTCD_minute">34</span><em>分</em>

<span class="lxfTCD_second">03</span><em>秒</em>

</div>

<div class="times4">

<i>剩余时间:</i>

<span class="lxfTCD_day">10</span><em>天</em>

<span class="lxfTCD_hour">08</span><em>时</em>

<span class="lxfTCD_minute">34</span><em>分</em>

<span class="lxfTCD_second">03</span><em>秒</em>

</div>

<div class="times5">

<i>剩余时间:</i>

<span class="lxfTCD_day">10</span><em>天</em>

<span class="lxfTCD_hour">08</span><em>时</em>

<span class="lxfTCD_minute">34</span><em>分</em>

<span class="lxfTCD_second">03</span><em>秒</em>

</div>

<div class="times6">

<i>剩余时间:</i>

<span class="lxfTCD_day">10</span><em>天</em>

<span class="lxfTCD_hour">08</span><em>时</em>

<span class="lxfTCD_minute">34</span><em>分</em>

<span class="lxfTCD_second">03</span><em>秒</em>

</div>

<div class="times7">

<i>剩余时间:</i>

<span class="lxfTCD_day">10</span><em>天</em>

<span class="lxfTCD_hour">08</span><em>时</em>

<span class="lxfTCD_minute">34</span><em>分</em>

<span class="lxfTCD_second">03</span><em>秒</em>

</div>

</body>

</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: