代码如下 | 复制代码 |
//settime($("#getPhoneCode"),60); function settime($obj, time) { if (time == 0) { $obj.attr( "disabled" , false ); $obj.css( "background" , "#f38401" ).css( "cursor" , "pointer" ); return ; } else { $obj.attr( "disabled" , true ); $obj.css( "background" , "#ccc" ).css( "cursor" , "not-allowed" ); $obj.text( "重新发送(" + time + ")" ); time--; } setTimeout( function () { settime($obj, time) }, 1000) } |