倒计时代码
2016-07-07 14:55 来源:www.chinab4c.com 作者:ecshop专家
团购网出现,好多人需要倒计时代码 我帖一个出来 index.php /** * 将GMT时间戳格式化为用户自定义时区日期 * * @param string $format * @param integer $time 该参数必须是一个GMT的时间戳 * * @return string */ function local_date($format, $time = NULL) { $timezone = isset($_SESSION['timezone']) ? $_SESSION['timezone'] : $GLOBALS['_CFG']['timezone']; if ($time === NULL) { $time = gmtime(); } elseif ($time <= 0) { return ''; } $time += ($timezone * 3600); return date($format, $time); } 复制代码function chagetime($time) { $time = local_date($GLOBALS['_CFG']['time_format'], $time); //echo $time;exit; $time = explode(" ",$time);//分割时间 $date = $time[0]; $time=$time[1]; $date=explode("-",$date); $year = (int)$date[0]; $month = (int)$date[1]; $day = (int)$date[2]; /*$time=explode(":",$time); $hour =$time[0]; $min =$time[1]; $sec =(int)$time[2]; $hour = (int)(24-$hour); $min =(int)(60-$min); $time=$hour.":".$min.":".$sec;*/ switch ($month) { case 1: $month_name = "Jan"; break; case 2: $month_name = "Feb"; break; case 3: $month_name = "Mar"; break; case 4: $month_name = "Apr"; break; case 5: $month_name = "May"; break; case 6: $month_name = "Jun"; break; case 7: $month_name = "Jul"; break; case 8: $month_name = "Aug"; break; case 9: $month_name = "Sep"; break; case 10: $month_name = "Oct"; break; case 1: $month_name = "Nov"; break; case 2: $month_name = "Dec"; break; } return $month_name." ".$day." ".$year." ".$time; } 复制代码function countDown(){ var i; var objArray =document.getElementsByTagName("label"); //alert(objArray.length); for (i=0;i<(objArray.length);i++) { if (objArray[i].id.indexOf("article_")>-1) { objHid = document.getElementById("hid_article_" + objArray[i].id.substring(objArray[i].id.indexOf("_")+1)); //objHid.value就是对应的时间值,然后改下面就行了 var d=Date.parse(objHid.value); var today=new Date(); var time=d-today; var 时间=objArray[i]; if(Math.floor(time)<=0){ 时间.innerHTML='抢购时间已过,谢谢您的关注!'; } else { var 天=Math.floor(time/(1000*60*60*24)); var 小时=Math.floor(time/(1000*60*60))%24; var 分=Math.floor(time/(1000*60))%60; var 秒=Math.floor(time/1000)%60; 时间.innerHTML=天+' 天'+小时+'小时'+分+'分'+秒+'秒'; 时间.style.fontSize='14px'; } } } setTimeout('countDown()',1000); } countDown(); </script> <label id='article_1'></label><input type='hidden' id='hid_article_1' value='<?php echo chagetime(time());?>' /> 复制代码 |
回答:
顶你个肺啊 |
布局颇乱!! |
includes/lib_goods.php中,找到 $goods[$idx]['url'] = build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']); 在这段代码的后面添加??是不是啊? |
支持下.. |
支持支持支持 |
最近更新
常用插件
- ecshop二次商品订购人信息
ecshop二次商品订购人信息填写插件,有时候给朋友送花,或者是送礼品的...
- ecshop二次开发详细页面生
插件介绍: ECSHOP系统,在很多时候,很多商品没有人购买,不但购买的人...
- ecshop分类批量扩展插件
ecshop分类批量扩展插件,这个插件是ecshop插件里面比较核心的插件。我们...
- ecshop2.7.1打印发货单插件
ecshop2.7.1打印发货单插件介绍:ecshop2.7.1和以前的ecshop版本不一样,ecs...
- ecshop商品分类名称增加样
ecshop插件介绍:本插件可以方便在后台管理,为ecshop商品分类名称增加样...
ecshop热门问答
ecshop热门资料
ecshop上傳
ecshop产品配送
ecshop打滚
ecshop下架商品显示
ecshop评论采集
ecshop拖动
ecshop黑客入侵
ecshop凡客诚品
ecshop短信设置
ecshop学生宿舍
ecshopMPC黑色风格
ecshopdiy装机
ecshop关系
ecshop红色
ecshopinformation
ecshop库内
ecshop送客
ecshop饮食
ecshopgateway
hprose
ecshop无法打开站点
ecshopchrome
ecshop向祖国献礼
ecshop注释
ecshop老友
ecshop新版
ecshop退款
ecshop发大财
ecshopplease
ecshop帐户