getElementByFormVaribleName?

Y

yawnmoth

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?
 
M

Martin Honnen

yawnmoth said:
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'.
 

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,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top