JavaScript闭包延时执行

闭包延时执行:

function test(){
var i = 0;
    (function(){
        if(i<5){
            alert(i);    
            window.setTimeout(arguments.callee,2000);
            i++;
        }
    })();
}
test();

posted on 2011-05-31 17:41  留痕  阅读(283)  评论(0编辑  收藏  举报