Home » questions » Why does substitution variables not work as part of the document object?
Why does substitution variables not work as part of the document object?
1
How come setting:
document.myformName.testname2.value = 'blah blah' will work,
but setting the document object using
document.formNameString.fieldNameString.value = 'blah blah';
using substitution variables will not work?
I really need a way to build the complete document string and have it interpret correctly as:
document.variableFormName.variableFieldName.value
where variableFormName and variableFieldName are variables.
The code I am using is:
function echoNameField(){
var formNameString = 'myformName';
var fieldNameString = 'testname';
document.formNameString.fieldNameString.value = 'blah blah';
document.myformName.testname2.value = 'blah blah';
}
