我希望我的倒计时在单击提交按钮时停止,我在某些页面中进行了搜索,但没有找到任何内容。这是我想在点击时停止的代码
function countDown (count) {
if (count > 0) {
var d = document.getElementById("countDiv");
d.innerHTML = count;
setTimeout (function() { countDown(count-1); }, 1000);
document.getElementById('tiempo').value = count;
}
else
document.location = "timeover.php";
}
document.getElementById("palabra").focus();
countDown(5);
</script>