亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

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

自己寫的 先擼為敬

<!doctype?html>
<html>
<head>
????<meta?charset="UTF-8">
<title>Document</title>
<style>
*{margin:0;padding:0;}
#faY{width:250px;?height:50px;?margin:20px;}
????#faY?.faY_1{?width:125px;?height:50px;float:left;?background:red;}
????#faY?.faY_1?input{?width:100px;?height:40px;?font-size:14px;?background:#efefef;font-weight:800;color:#0ee;margin:5px?12px;}
????#faY?.faY_2{?width:125px;?height:50px;float:right;?background:#ff0;?text-align:center;line-height:50px;font-weight:800;color:#0ee;font-size:20px;display:none;}
</style>
<script?type="text/javascript">
window.onload=function(){
???var?send=document.getElementById('send'),
???????send_1=document.getElementById('faY_2'),
???????times=60,
???????timer=null;
???send.onclick=function(){
????????????if?(times>0&&times<60)?{
?????????????send.onclick=null;
????????????};
????clearInterval(timer);
????send.style.cssText="color:#fff";
????send_1.style.cssText="display:block";
????//send.onclick=null;
????timer=setInterval(function(){
????times--;
????if?(times<=0)?{
????send_1.style.cssText="display:none";
????send.style.cssText="color:#0eee";
????times=60;
????clearInterval(timer);

????};
????send_1.innerHTML=times+"秒后重試";
????},500);
???}?
}
</script>
</head>
<body>
????<div?id="faY">
????????<div>
???????????<input?type="button"?id="send"?value="發送驗證碼">
????????</div>
????????<div?id="faY_2">60秒后重試</div>
????</div>

</body>
</html>


正在回答

1 回答

你這個代碼沒有辦法使用第二次,是因為在結束后你忘記把timer給初始化回來了,你在clearInterval(timer)后面,需要加再一行timer=null,就可以反復使用

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

舉報

0/150
提交
取消

自己寫的 先擼為敬

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

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

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

公眾號

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