Síntasix

Ejemplo

<form action="" name="formA">
<input type="text" value="foo">
</form>
<script type="text/javascript">
// Get a reference to the first element in the form
var formElement = document.forms['formA'].elements[0];
// Give it a name
formElement.name = 'inputA';
// Show the value of the input
alert(document.forms['formA'].elements['inputA'].value);
</script>