naming a form element with a variable?

L

libsfan01

what am i doing wrong here, im trying to name a field to add a value
to in a form by use of a variable?

var field = 'content'; //field name is content
document.update.field.value = string;
 
R

Randy Webb

libsfan01 said the following on 7/23/2006 8:41 AM:
what am i doing wrong here, im trying to name a field to add a value
to in a form by use of a variable?

var field = 'content'; //field name is content
document.update.field.value = string;

document.forms['update'].elements[field].value
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top