Return to Snippet

Revision: 30462
at August 14, 2010 01:17 by cfleschhut


Initial Code
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);
    }
};

Initial URL
http://jsfiddle.net/YwtEz/

Initial Description

                                

Initial Title
JavaScript Event Handler Closure

Initial Tags
javascript

Initial Language
JavaScript