//jquery倒计时
function setRemainTime(id, o) {
var count = $(id).text() || 60,//id为数值的选择器
time = count,
countdown;
countdown = setInterval(function () {
time--;
$(id).text(time);
if (time < 0) {
clearInterval(countdown);
$(id).text(count);
}
if (typeof o.func == 'function') {
o.func(); //倒计一秒需要同步执行的函数
}
if (time == -1) {
if (typeof o.callback == 'function') {
o.callback(); //倒计时完成需要执行的回调函数
}
}
}, 1000);
}