1 代码示例
<script>function fnShow(name, age){alert("ok" + name + age);// 销毁定时器tid1clearTimeout(tid1)}// 根据时间间隔调用一次函数的定时器// 1-定时器要执行的函数, 2-时间间隔(ms), 3..-参数var tid1 = setTimeout(fnShow, 2000, "李四", 20);// 根据时间间隔循环调用函数的定时器var tid2 = setInterval(fnShow, 3000, "王五", 30);</script>
