How to - form element variable

Hello,
Im using a combo of asp and javascript in a web site. Depending on how many records are open when I poll the database is how many form elements I use to present the data to the user. The user then has the ability to close record. From here is when I get stuck… here is what I have.
Varcount is the amount of form elements I have and is passed in to the validation.
////////////////////////////////////////////////////

var i
while (varcount>0) {

if (form.action[varcount].options[form.action[varcount].selectedIndex].value==1)

varcount–;

}
//////////////////////////////////////////////////

I have tried +varcount+, “varcount”

Thanks, Im gakked out on this JS