为什么需要下面的红色那个(i),它的作用是什么?
function test() {
var i;
for (i = 0; i < 4; i += 1) {
document.getElementById("e"+i).onclick = function (i) {
return function (e) {
alert(i);
};
}color=red[/color];
}
}
一直用着,可是不知道为什么,希望能帮我解惑,thank you !