懂视1
懂视101
懂视201
懂视301
懂视401
懂视501
懂视601
懂视701
懂视801
懂视901
懂视1001
懂视1101
懂视1201
懂视1301
懂视1401
懂视1501
懂视1601
懂视1701
懂视1801
懂视1901
文库1
文库101
文库201
文库301
文库401
文库501
文库601
文库701
文库801
文库901
文库1001
文库1101
文库1201
文库1301
文库1401
文库1501
文库1601
文库1701
文库1801
文库1901
高士教育
全部频道
首页
科技
教育
生活
旅游
时尚
美容
美食
健康
体育
游戏
汽车
家电
您的当前位置:
首页
js模仿网上的限时抢购效果_时间日期
js模仿网上的限时抢购效果_时间日期
来源:高士教育
抢购时间倒计时效果
function $(element){ return document.getElementById(element); } //限时抢购 var the_s=new Array(); function view_time(the_s_index,objid){ if(the_s[the_s_index]>=0){ var the_D=Math.floor((the_s[the_s_index]/3600)/24) var the_H=Math.floor((the_s[the_s_index]-the_D*24*3600)/3600); var the_M=Math.floor((the_s[the_s_index]-the_D*24*3600-the_H*3600)/60); var the_S=(the_s[the_s_index]-the_H*3600)%60; html = "还剩 "; //if(the_D!=0) html += the_D+"天"; if(the_D!=0 || the_H!=0) html += ''+(the_H+(the_D*24))+"小时"; if(the_D!=0 || the_H!=0 || the_M!=0) html += ''+the_M+"分"; html += ''+the_S+"秒"; $(objid).innerHTML = html; the_s[the_s_index]--; }else{ $(objid).innerHTML = "已结束"; } } script>
还剩 14小时49分44秒
var startDate= new Date("2010/07/16 09:07:43"); var endDate= new Date("2010/07/17 00:00:00"); the_s[2402]=(endDate.getTime()-startDate.getTime())/1000; setInterval("view_time(2402,'xsq_2402')",1000); script>
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
显示全文