[阅读: 342] 2009-12-17 08:12:54
for (var i=1; i<prog_devices.length; i++)
{
if (prog_devices[i].id == devidx) continue;
var target = prog_devices[i].id;
menuDevice.push({text:prog_devices[i].caption,
handler:function(){Gok.Smt.Prog.moveMats(prog, devidx, target)}});
}
我调用moveMats之后,为啥target都是一样的,跟i是哪个无关呢?
这种异步调用的该如何处理变量呢?