[Phpwm] [OT] JavaScript Scope Problem

Greg Jones greg.jones at gmail.com
Fri Aug 10 17:20:15 BST 2007


you'd need to do:

for(i=0;i<blah;i++) {
  [...]
  box.onclick = function(x) {
    return function() { alert(x); };
  }(i);
}

where 'alert(x)' will be where you put whatever it is you actually want to do.

Greg



More information about the Phpwm mailing list