ダウンロードボタンをクリックするまでカウントダウンするこのJavaScript機能はありますが、一度クリックすると再度無効にするか、もう一度カウントダウンするか、できれば無効にする。クリックしてカウンタを再起動するか無効にする - Javascript
ここにJavaScriptがあります。ここで
<script type="text/javascript">
x = 10;
function countdown() {
if (x > 1) {
x--;
document.getElementById("button").innerHTML = x;
r = setTimeout("countdown()",1000);
}
else {
clearTimeout(r);
document.getElementById("button").innerHTML = "Click to download";
document.getElementById("button").disabled = "";
}
}
r = setTimeout("countdown()",1000);
</script>
ボタンは、
<label><font size="5">Your download will start in: </label><a href="download.php?shortURL=<?php echo $fullfile; ?>"><button class="btn orange" id="button" disabled="disabled" onclick="window.location.reload()" >10</button></font></a>
感謝です!
あなたに問題を与えていますか? –
あなたのHTMLが不正です。「」タグは、「
問題はありません。ボタンをクリックすると、カウンタが再び開始されるようにしたいだけです。 – HarryBeasant