// 计时器 function Timer(ele) { this._mStr = ''; this._sStr = ''; this._m = 0; this._s = 0; this._setTimer; this._init = function () { var self = this; self._setTimer = setInterval(function() { if (self._s >= 59) { self._m += 1; self._s = 0; } else { self._s += 1; } self._sStr = self._s < 10 ? '0'+self._s : self._s; self._mStr = self._m < 10 ? '0'+self._m : self._m; $(ele).val(self._mStr+':'+self._sStr); }, 1000); }; this._clear = function () { clearInterval(this._setTimer); }; this._init(); }