-1
<button type="submit" class="submitbtn" id="submit" disabled="disabled" name="submit" >Submit Form</button>
<p id="timeLeft"> You can send form again after: 86400 seconds </p>
</div>
</form>
</div>
<script type="text/javascript">
setTimeout (function(){
document.getElementById('submit').disabled = null;
},86400000);
var countdownNum = 86400;
incTimer();
function incTimer(){
setTimeout (function(){
if(countdownNum != 0){
countdownNum--;
document.getElementById('timeLeft').innerHTML = 'You can send form again after: ' + countdownNum + ' seconds ' + '(24hours)';
incTimer();
} else {
document.getElementById('timeLeft').innerHTML = 'You can now make a result again!';
}
},1000);
}
</script>
這是我javacode,但如果我refersh頁面,倒計時也refresh..this提交表單禁用,它會之後24小時(86,400秒)再次提交Java腳本的形式提交倒計時沒有復位,如果刷新
什麼部分應該放存儲代碼? – Zipp
好的謝謝你!但是,如果我改變了,我會設置3分鐘,或1小時?爲什麼沒有發生,如果我改變countdownNum? – Zipp
仍然可以點擊即使計時器尚未完成? – Zipp