ecshop 限时抢购多个促销产品倒计时

<meta http-equiv="Content-Type"content="text/html; charset=gbk">
<!-- {if $promotion_goods} -->
<script >
var Tday = new Array();
var daysms = 24 * 60 * 60 * 1000
var hoursms = 60 * 60 * 1000
var Secondms = 60 * 1000
var microsecond = 1000
var DifferHour = -1
var DifferMinute = -1
var DifferSecond = -1
function clock(key)
{
 
  var time = new Date()
    var hour =time.getHours()
    var minute =time.getMinutes()
    var second =time.getSeconds()
    var timevalue = ""+((hour> 12) ? hour-12:hour)
    timevalue +=((minute< 10) ? ":0":":")+minute
    timevalue +=((second< 10) ? ":0":":")+second
    timevalue +=((hour>12 ) ? " PM":" AM")
    var convertHour =DifferHour
    var convertMinute =DifferMinute
    var convertSecond =DifferSecond
    var Diffms =Tday[key].getTime() - time.getTime()
    DifferHour = Math.floor(Diffms/ daysms)
    Diffms -= DifferHour *daysms
    DifferMinute =Math.floor(Diffms / hoursms)
    Diffms -= DifferMinute *hoursms
    DifferSecond =Math.floor(Diffms / Secondms)
    Diffms -= DifferSecond *Secondms
    var dSecs = Math.floor(Diffms/ microsecond)
 
    if(convertHour != DifferHour)a="<fontcolor=red>"+DifferHour+"</font>天";
    if(convertMinute !=DifferMinute) b="<fontcolor=red>"+DifferMinute+"</font>时";
    if(convertSecond !=DifferSecond) c="<fontcolor=red>"+DifferSecond+"</font>分"
        d="<fontcolor=red>"+dSecs+"</font>秒"
        if (DifferHour>0) {a=a}
        else {a=''}
    document.getElementByIdx_x("leftTime"+key).innerHTML = a + b + c + d;//显示倒计时信息

}
</script>
<div id="sales" class="f_lclearfix">
          <h1><ahref="../search.php?intro=promotion"><imgsrc="images/more.gif"/></a></h1>
            <div class="clearfix goodBox">
                <!--{foreach from=$promotion_goods key=keyitem=goods name="promotion_foreach"}-->
                {if $smarty.foreach.promotion_foreach.index <=3}
                    <div class="goodList">
                    <ahref="{$goods.url}"><imgsrc="{$goods.thumb}" border="0"alt="{$goods.name|escape:html}"/></a><br/>
          <p><ahref="{$goods.url}"title="{$goods.name|escape:html}">{$goods.short_name|escape:html}</a></p>
                    {$lang.promote_price}<fontclass="f1">{$goods.promote_price}</font><br><fontclass="f4"id="leftTime{$key}">{$lang.please_waiting}</font>
                    </div>
                {/if}
<script>
Tday[{$key}] = new Date("{$goods.gmt_end_time}"); 
window.setInterval(function()     
{clock({$key});}, 1000);     
</script>
                <!--{/foreach}-->
            </div>
          </div>
     
<!-- {/if} -->

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值