Here is a way to make selections:
var input = document.getElementsByTagName("INPUT");
var j = 0;
for (var i = 0; i < input.length; i++) {
if (input[i].type == "text") {
if (input[i].value == "First") {
input[i].value == "Second"
}
}
}
If you know the index of the element in the DOM, you can do this directly:
<HTML>
<FORM>
<input id='random_value' name='random_name' value='First'/>
<input id='random_value' name='random_name' value=''/>
</FORM>
</HTML>
You can set the value like this:
document.forms[0].elements[0].value=document.forms[0].elements[1].value;
If the form is first and the text box is the first element of the form, otherwise you can specify the index instead.
If you don't know the index, you can loop through all elements, check for the value "First," and make changes accordingly.