日期:2014-05-16  浏览次数:20523 次

帮忙看个js代码,最后那个(i)怎么理解?
如题:
JScript code

<script type="text/javascript"> 
     for(var i=0;i<sum;i++){ 
            oSubLi[i].onmouseover = (function(i){
                return function(){
                    
                }
            })(i) 
    }    
  </script>



------解决方案--------------------
http://wlog.cn/javascript/javascript-closures.html
------解决方案--------------------
楼主可以仔细看看
http://www.cn-cuckoo.com/main/wp-content/uploads/2009/12/named-function-expressions-demystified.html