回首忆惘然
setTimeout(expression, timeout);超时后运行一次代码/函数。setInterval(expression, timeout);每隔一段时间运行代码/函数,并在它们之间设置超时时间。例子:var intervalID = setInterval(alert, 1000); // Will alert every second.// clearInterval(intervalID); // Will clear the timer.setTimeout(alert, 1000); // Will alert once, after a second.