标签:style blog http color cti io
<script src="http://code.jquery.com/jquery-latest.js"></script> <input type="button" onclick="setclock($(this),10);" value="获取验证码"> <script> function setclock(dom,value,text) { value=arguments[1]||60; text=arguments[2]||"s后可重发验证码"; dom.attr("disabled","disabled"); if(!dom.attr("data-clock")) { dom.attr("data-dvalue",dom.val()); value--; dom.attr("data-clock",value); dom.val(value+text); }else { var thisValue=parseInt(dom.attr("data-clock"))-1; dom.attr("data-clock",thisValue); dom.val(thisValue+text); } if(parseInt(dom.attr("data-clock"))>0) { setTimeout(function(){setclock(dom,value,text)},1000); }else { dom.removeAttr("disabled"); dom.removeAttr("data-clock"); dom.val(dom.attr("data-dvalue")); } } </script>
js获取验证码 秒表效果(原创),布布扣,bubuko.com
标签:style blog http color cti io
原文地址:http://www.cnblogs.com/zhudongchang/p/3818603.html