function settime(obj) {
    if(second == 0){
        obj.removeAttribute("disabled"); 
        obj.value="获取验证码"; 
        second = 300; 
        return;
    }else{
        obj.setAttribute("disabled", true); 
        obj.value="重新发送(" + second + ")"; 
        second--; 
    }
timeId = window.setTimeout(function(){settime(obj)},1000);
};

 

obj参数传入this即可。