之间的主要区别是什么
设置时间间隔 https://developer.mozilla.org/En/window.setInterval
and
设置超时时间 https://developer.mozilla.org/en/window.setTimeout
在 JavaScript 中?
setTimeout(expression, timeout);
运行代码/函数once超时后。
setInterval(expression, timeout);
运行代码/函数反复,以及每次重复之间的超时长度。
Example:
var intervalID = setInterval(alert, 1000); // Will alert every second.
// clearInterval(intervalID); // Will clear the timer.
setTimeout(alert, 1000); // Will alert once, after a second.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)