本文主要和大家分享js實(shí)現(xiàn)短信驗(yàn)證碼讀秒功能,希望能幫助到大家。
js部分
<script type="text/javascript"> var countdown=60; function settime(obj) { if (countdown == 0) { obj.removeAttribute("disabled"); obj.value="免費(fèi)獲取驗(yàn)證碼"; countdown = 60; return; } else { obj.setAttribute("disabled", true); obj.value="重新發(fā)送(" + countdown + ")"; countdown--; } setTimeout(function() { settime(obj) } ,1000); } function dd(){ var obj = document.getElementById("test1"); obj.innerHTML=""; var nullOp = document.createElement("option"); nullOp.setAttribute("value", ""); nullOp.appendChild(document.createTextNode("請選擇")); obj.appendChild(nullOp); for ( var int = 0; int < 1; int++) { var op = document.createElement("option"); op.setAttribute("value", "123"); op.appendChild(document.createTextNode("123")); obj.appendChild(op); } }); </script> html部分 <input type="button" id="btn" value="免費(fèi)獲取驗(yàn)證碼" onclick="settime(this)" /> <input type="text" id="dd" onclick="dd()" value="sdf" />
相關(guān)推薦:
怎么用php實(shí)現(xiàn)短信驗(yàn)證碼發(fā)送、
JS實(shí)現(xiàn)短信驗(yàn)證碼
JS實(shí)現(xiàn)用戶注冊時(shí)獲取短信驗(yàn)證碼和倒計(jì)時(shí)功能的示例代碼分享
以上就是js實(shí)現(xiàn)短信驗(yàn)證碼讀秒功能的詳細(xì)內(nèi)容,更多請關(guān)注php中文網(wǎng)其它相關(guān)文章!