(function(){})()使用定时器需要arguments.callee


<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>(function(){})()使用定时器需要arguments.callee</title>

<input type="button" value="开始" id="btn1">
        
<script type="text/javascript">

(function(){

    var c=0;
    var btn1=document.getElementById('btn1');
    function func(){
        btn1.value=c++;
        setTimeout(arguments.callee,500);
    }
    btn1.onclick=function(){
        func();
    }
    
})();


</script>


程序运行结果如下,点击这里亲自运行看看