All pastes #494482 Raw Edit

Something

public text v1 · immutable
·published 2007-05-18 08:38 UTC
rendered paste body
function myFn(x) {

    el = [];

    for (i = 1; i < arr[x].length; i++) {

        el[i] = document.createElement('div');

        if (!arr[x][i][2]) {
            el[i].appendChild(document.createTextNode(arr[x][i][1]]));
        }

        el[i].onclick = function(x,i) { /* arr is global */
            if (arr[x][i][3]) alert(arr[x][i][3]); /* Error: "i has no properties" */
        }

        document.body.appendChild(el[i]);

    }

}