JavaScriptを使用してカウントダウンを作成しようとしています。ここからいくつかのコードを取得し、少し修正しました。
<script type="text/javascript">
var c=10, t;
function timedCount() {
document.getElementById('txt').value=c;
c=c-1;
t=setInterval("timedCount()",1000);
}
function stopCount() {
clearInterval(t);
}
</script>
ユーザーがリンクをクリックするまで、カウントダウンを繰り返し呼び出す必要があります。リンクがクリックされるまで、毎秒 10 から 1 ずつ (10,9,8,7,6...0) カウントダウンする必要がありますが、クリックされません。誰でも私を助けることができますか?
編集:カウントダウンが0になったらカウントダウンを再開する方法を知っている人はいますか?
前もって感謝します。