var win = new Window(
palette { \
A: Button { text: '0' }, \
B: Button { text: '1' }, \
C: Button { text: '2' }, \
D: Button { text: '3' }, \
E: Button { text: '4' }, \
F: Button { text: '5' }, \
G: Button { text: '6' }, \
H: Button { text: '7' }, \
I: Button { text: '8' }, \
J: Button { text: '9' } \
}
);
win.show();
function attachButtonsEvent(index) {
return function () {
alert(index);
};
}
for (var i = 0, l = win.children.length; i < l; i++) {
win.children[i].onClick = attachButtonsEvent(i);
}
暂无讨论,说说你的看法吧