By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,576 Members | 1,462 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,576 IT Pros & Developers. It's quick & easy.

naming a form element with a variable?

P: n/a
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;

Jul 23 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jul 23 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.