Looping through elements

I must be missing something.

I have three buttons, for example, called “btn_add1”, “btn_add2”, “btn_add3”.

Can I not loop through them using something like this:

for (var i = 1 ; i <= 3 ; i++)
{
	btn_add[i].bgcolor = '#ff0000';
}

You can do it like this:

for (var i = 1 ; i <= 3 ; i++) 
{ 
   elements['btn_add'+i].bgcolor = '#ff0000'; 
}

Excellent. Thanks.