473,414 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

getElementByFormVaribleName?

It's easy enough to get elements by their id (getElementById) or by
their type (getElementsByTagName). What about doing so for form
variable names? How might one go about getting the element(s)
associated with document.forms[0].varname?

Oct 20 '06 #1
1 1007
yawnmoth wrote:
It's easy enough to get elements by their id (getElementById) or by
their type (getElementsByTagName). What about doing so for form
variable names? How might one go about getting the element(s)
associated with document.forms[0].varname?
document.forms['formname']
gives you the HTML form element(s)with name 'formname'.
document.forms.formName.elements['controlname']
gives you the control(s) (e.g. input, textarea, select) with name
'controlname' in the form with name 'formName'.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Oct 20 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.