Ruby's Louvre

每天学习一点点算法

导航

闭包的应用

var ary = ["foo1","foo2","foo3"];

for (var i = 0, len = ary.length; i < len; i++) {
  setTimeout(function(){
    document.getElementById(ary[i]).style.display = "none";
  },0);
}

posted on 2010-02-08 16:24  司徒正美  阅读(1146)  评论(2编辑  收藏  举报