1
なぜclearIntervalが下で動作しないのか分かりません。誰も私のコーディングで何が問題なのか教えてください。clearIntervalを動作させるには?
ありがとうございました!
function timehandle(){
alert("Take a break")
}
setInterval(timehandle, 5000);
var getout=setInterval(timehandle, 5000);
var button=document.getElementById("button");
button.onclick=clearInterval(getout);
なぜ2のsetIntervalの? 'button.onclick = function(){clearInterval(getout);};' –
2つの間隔を作成するためです。あなたは2位ではなく1位をキャンセルします。 – Dmitry