var news; function newPage(){ news = window.open("new_file.html","newPage","width=500,height=500,top=250,left=250,resizable=no,location=no,menubar=no"); }
</script>
setIntel(函数的引用,时间间隔);
setInterval()在指定的时间间隔重复调用指定的函数
示例
var i = 0;
function fun(){
document.close();
document.open();
document.write(i++);
}
setInterval(fun,1000);
setTimeout();停止setInterval的执行
示例:
<script>
var i = 0;
function fun(){
console.log(i++);
}
var interval = setInterval(fun,100);//使用变量接收计时器的句柄(对象的引用)