This statement:
setTimeout(clearInterval(intID), 10000);
means, "call the function 'clearInterval' passing the value of variable 'intID', and then pass the return value of that and the number 10000
to the function 'setTimeout'."
In other words, you're calling the function "clearInterval" and then passing the returned value to setTimeout()
.
Instead, pass setTimeout()
a function:
setTimeout(function() { clearInterval(intID); }, 10000);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…