Dont Create Functions in a For Loop
for(var i = 1; i <= 3;="" i++)="" {="" var="" btn="document.getElementById('button'+i);" btn.onclick="function()" alert('hello="" from="" button="" '="" +="" i);="" };="" }="" <="" pre="">

    What will get alerted?