我這個for循環是遍歷了所有li標簽 也就是所有aLi綁定了事件,讓他的菜單延遲消失300毫秒,有什么好的辦法呢?for(var i = 0,len = aLi.length;i<len;i++){ ? ? ? ? ? ? ? ?aLi[i].onmouseout = function(){ ? ? ? ? ? ? ? ? ? ?(function(i){ ? ? ? ? ? ? ? ? ? ? ? ?timer = setTimeout(function(){ ? ? ? ? ? ? ? ? ? ? ? ? ? ?aLi[i].children[1].style.display = 'none'; ? ? ? ? ? ? ? ? ? ? ? ?},300); ? ? ? ? ? ? ? ? ? ?})(i);
js如何在循環體內訪問局部作用域
江城fen
2018-04-13 19:12:59