第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

求大神指導,在火狐里有BUG

<!DOCTYPE?html>
<html>
????<head>
????????<meta?charset="UTF-8">
????????<title>發(fā)送驗證碼練習</title>
????<style?type="text/css">
????????.nosend{width:?120px;height:?50px;background-color:?#999999;color:?#FFFFFF;margin:?30px?400px;}
????????.send{width:?120px;height:?50px;background-color:?#0C4E7C;color:?#FFFFFF;margin:?30px?400px;}
????</style>
????</head>
????<body>
????????<input?type="button"?id="send"?value="發(fā)送驗證碼"?class="send"/>
????</body>
????<script?type="text/javascript">

????????var?mybtn=document.getElementById("send");
????????var?timer=null;
????????var?index=10;
????????mybtn.onclick=function(){
????????????if(timer){clearInterval(timer);timer=null;}
????????????mybtn.setAttribute("disabled","disabled");
????????????mybtn.setAttribute("class","nosend");
????????????timer=setInterval(function(){
?????????????index--;
?????????????mybtn.value=index+"后重新發(fā)送";
?????????????if(index<0){
?????????????????clearInterval(timer);
?????????????????mybtn.removeAttribute("disabled");
?????????????????mybtn.setAttribute("class","send");
?????????????????mybtn.value="重新發(fā)送驗證碼";
?????????????????index=10;
?????????????}
????????????},1000);
????????}

????</script>
</html>

這是完整代碼,有一個BUG,在火狐瀏覽器里第一次運行正常,當刷新頁面的時候會自動加上一個disabled屬性,而在谷歌瀏覽器里就正常,這是為什么呢?

還有,提示里的disabled屬性設置為‘true’或‘false’好像并不管用。

正在回答

2 回答

window.onload=function(){

? ?var send=document.getElementById('send'),

? ? ? ?times=60,

? ? ? ?timer=null;

? ?send.onclick=function(){

???? ? ? timer=setInterval(function(){

???????? ? ? times--;

???????? ? ? if(times<=0){

???????? ? ? send.value="發(fā)送驗證碼"

???????? ? ? clearInterval(timer);

???????? ? ? send.disabled=""

???????? ? ? times=60;

???????? ? ? }else{

???????? ? ? send.value=times+"秒后重試";

???????? ? ? send.disabled="disabled"

???????? ? ? }

???? ? ? },1000)

? ? ?// 計時開始?

? ?}?

}

自認為代碼很簡單,你試試,

0 回復 有任何疑惑可以回復我~

看不懂

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

求大神指導,在火狐里有BUG

我要回答 關注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號