I see from here that we can set value for the first element by document.getElementsByName('Contact0Email')[0].value = email;
and second element by document.getElementsByName('Contact0Email')[1].value = email;
and so on.
But how to set values for all the text fields with same name attribute?