51可用代码模板网站

咨询热线:

181-1164-6936
  • 1
ECSHOP商城
当前位置:首页>实用代码>ECSHOP商城>

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

时间:2017-08-11 08:59点击:

直接上页面代码 


<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} -->


51可用模板(代码)网站专为广大站长朋友提供精品模板与代码,同时免费提供网站收录。
本站域名: WWW.51KYDM.COM    联系方式:QQ:182468923    手机:18111646936
本站关键词:网站链接收录网址收录入口网站免费提交收录网站收录提交入口    网站地图
51可用模板
展开