//倒计时的插件
$.fn.extend({
oaoTime: function (nowTime) {
this.each(function () {
var dateStr = $(this).attr("end-date");
var endDate = new Date(dateStr.replace(/-/g, "/"));//取得指定时间的总毫秒数
//now是在动态页面中取得服务器的时间,如果没有定义使用客户端时间
now = nowTime;
if (nowTime == undefined) {
now = new Date().getTime();
}
var tms = endDate - now;//得到时间差
// if (tms < 0) {
// alert("时间过期了");
// return;
// }
$.oaoTime.timers.push({tms: tms, content: $(this)});
$.oaoTime.start();
});
}
});
//倒计时的插件
$.oaoTime = {
//倒计时容器,所有需要倒计时的时间都需要注册到这个容器中,容器中放的是一个object,object描述了倒计时的结束时间,以及显示时间的jquery对象(例如div)
timers: [],
//全局的一个倒计时状态,init表示初始化状态,start表示运行中状态&#