/ Published in: JavaScript
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
window.onload = function() {
var ul = document.getElementById("foo");
var lis = ul.getElementsByTagName("li");
for(var i=0; i<lis.length; i++) {
lis[i].onmouseover = function(x) {
return function() {
console.log(x);
}
}(i);
}
};
URL: http://jsfiddle.net/YwtEz/
Comments
 Subscribe to comments
                    Subscribe to comments
                
                