You need to figure out the field object based on the name...
document.forms[0][strNames[i]].value = strValues[i]; // set value on page
I can't say this will definately work (not sure about the element array, it might be form[0].elements[...]), but this is the general idea. You need to use the value from your names array to find the element in the form.
Alternatively you could use the eval() method to find it:
objFormElement = eval("document.forms[0]."+strNames[i]);
objFormElement.value = strValues[i]; // set value on page
Lastly, there's the getElementById method, but this work only if you have a value in the ID attribute of each input (I think):
objFormElement = document.getElementById(strNames[i]);
objFormElement.value = strValues[i]; // set value on page
(Sorry for the uncertainty of these suggestions. I gave you three in the hopes one would work.)
Peter
------------------------------------------------------
Work smarter, not harder.
|