function GetCode (element){
this._init_(element);
}
GetCode.prototype = {
constructor : GetCode,
_init_ : function(element) {
this.clock = '';
this.nums = 60;
this.btn = element;
},
sendCode: function (){
this.btn.disabled = true;
this.btn.value = this.nums + '秒后可重发';
var that = this
this.clock = setInterval(this.doLoop(that), 1000);
},
doLoop: function(that){
var fuc = function(){
that.nums--;
if(that.nums > 0) {
that.btn.value = that.nums + '秒后可重发';
} else {
clearInterval(that.clock);
that.btn.disabled = false;
that.btn.value = '获取验证码';
that.nums = 60;
}
}
return fuc;
}
}