I have a c++ application that runs a bunch of simulations and updates my website with the results. Part of the update is an input form which reflects the current state of the system being simulated.

On this input form Ihave a series of drop downs all named as follows:


It's more or less like an array

So then to get the value from these drop downs I am doing this

for (var i = 1; i<n; i++){
var dropName = "chooser" + i;
selectedValue = document.getElementById(dropName).value;
But the javascript is hanging up on the getElementById statement (I know this because I've commented it out and the JS flows beyond that point in the code). I have also confirmed that the dropName that is created with the concatenation is accurate.

What am I doing wrong. And is there any way to do with with a proper array rather than this 'hack' array?