2 mshzg1314 mshzg1314 于 2013.10.16 11:03 提问

如果有三条记录 list最后一条倒计时不显示

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



秒杀抢购<#if setting.isShowPoweredInfo> - Powered By ChinaBuy</#if>










<!--公共样式--> #box{width:100px;padding:2px 3px;overflow:hidden; text-overflow:ellipsis;white-space:nowrap;/* 不换行 */} A.applink:hover {border: 2px dotted #DCE6F4;padding:2px;background-color:#ffff00;color:green;text-decoration:none} A.applink {border: 2px dotted #DCE6F4;padding:2px;color:#2F5BFF;background:transparent;text-decoration:none} A.info {color:#2F5BFF;background:transparent;text-decoration:none} A.info:hover {color:green;background:transparent;text-decoration:underline}

0)>
  • #if>

    20)> ${(promotion.ccGoods.name).substring(0,20)+"..."} ${promotion.ccGoods.name} #if>

    ${promotion.price?string(currencyFormat)}

    市场价

    ${promotion.ccGoods.marketPrice?string(currencyFormat)}

    您节省

    ${(promotion.ccGoods.marketPrice-promotion.price)?string(currencyFormat)}

    折扣:#{(promotion.price/promotion.ccGoods.marketPrice*10);M2}折

    已有${promotion.ccGoods.xiaoLiang}人购买,

    ${promotion.introduction}

  • #if> #list>
#if>
20)> ${(promotion.ccGoods.name).substring(0,20)+"..."} ${promotion.ccGoods.name} #if>

${promotion.price?string(currencyFormat)}

市场价:${promotion.ccGoods.marketPrice?string(currencyFormat)}

#if> #list>

2)>
市场价:${promotion.ccGoods.marketPrice?string(currencyFormat)}     已成交:${promotion.ccGoods.xiaoLiang}
¥${promotion.price}
说明: 20)> ${(promotion.introduction).substring(0,20)+"..."} ${promotion.introduction} #if>
#if> #list>
没有找到任何记录!
#if>
var pageObject={ topSecKill:1, base:'', goodsUrlPrefix:'http://mall.etong.com/item.html?id=' }

<!--倒计时JS-->

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(jstime,id,kstimes,biaoshi) { var bdtime=kstimes.getTime(); 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 keydate = new Date(jstime); var Diffms = keydate.getTime() - time.getTime(); if(time.getTime()<bdtime) { Diffms=bdtime-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=''} if(time.getTime()<bdtime) { if(biaoshi=="time") { document.getElementById(biaoshi+id).innerHTML = a + b + c +d;; //距离开始显示倒计时信息 document.getElementById("bgimg"+id).style.background="url(${base}/template/shop/images/surprised_price_hei.gif)"; document.getElementById("imgId"+id).src = "${base}/template/shop/images/grounp_buy_now_disable.gif"; document.getElementById("zhuangtai"+id).style.background="url(${base}/template/shop/images/grounp_S1_ks.gif)"; } else if(biaoshi=="stime") { document.getElementById("smlimg"+id).style.background="url(${base}/template/shop/images/grounp_item_bg_hei.gif)"; document.getElementById(biaoshi+id).innerHTML = "距开始:"+a + b + c +d;; //距离开始显示倒计时信息 } } else if(time.getTime()>keydate.getTime()) { if(biaoshi=="time") { document.getElementById(biaoshi+id).innerHTML = "活动已结束"; document.getElementById("bgimg"+id).style.background="url(${base}/template/shop/images/surprised_price_hei.gif)"; document.getElementById("imgId"+id).src = "${base}/template/shop/images/grounp_buy_now_disable.gif"; document.getElementById("zhuangtai"+id).style.background="url(${base}/template/shop/images/grounp_S1_ks.gif)"; } else if(biaoshi=="stime") { document.getElementById("smlimg"+id).style.background="url(${base}/template/shop/images/grounp_item_bg_hei.gif)"; document.getElementById(biaoshi+id).innerHTML = "活动已结束"; } } else if(bdtime<=time.getTime()<=keydate.getTime()) { if(biaoshi=="time") { document.getElementById(biaoshi+id).innerHTML = a + b + c +d; //距离结束显示倒计时信息 } else if(biaoshi=="stime") { document.getElementById(biaoshi+id).innerHTML = "距结束:"+a + b + c +d; //距离结束显示倒计时信息 } } } function NewDate(str) { str = str.split('-'); var date = new Date(); date.setUTCFullYear(str[0], str[1] - 1, str[2]); date.setUTCHours(0, 0, 0, 0); return date; } function call() { <#list plist as promotion> <#if (promotion_index<2)> var time="${promotion.endDate}"; time=time.substring(0,19); var pid="${promotion.id}" var Tdaykey = new Date(Date.parse(time.replace(/-/g, "/"))); var beginTime="${promotion.beginDate}"; beginTime=beginTime.substring(0,19); var beginDate=new Date(Date.parse(beginTime.replace(/-/g, "/"))); var bdtime=beginDate.getTime(); clock(Tdaykey,pid,beginDate,"time"); </#if> </#list> <#list plist as promotion> <#if (promotion_index>2)&&(promotion_index!=2)> var time="${promotion.endDate}"; time=time.substring(0,19); var pid="${promotion.id}" var Tdaykey = new Date(Date.parse(time.replace(/-/g, "/"))); var beginTime="${promotion.beginDate}"; beginTime=beginTime.substring(0,19); var beginDate=new Date(Date.parse(beginTime.replace(/-/g, "/"))); var bdtime=beginDate.getTime(); clock(Tdaykey,pid,beginDate,"stime"); </#if> </#list> } window.setInterval(function(){call();}, 1000);

1个回答

xialxl
xialxl   2013.10.16 11:19

本想看看能不能帮你解决,看到这么长的代码,而且js还是没有格式化的,唉,算了吧。还是你自己研究吧。我已无力回天。

mshzg1314
mshzg1314 我有排好的 传到这上就乱了 可以加q帮我一下吗 我已经研究很久了都没法破
4 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!