[Javascript] Selecting a form element

Peter Brunone peter at brunone.com
Wed Oct 4 15:38:33 CDT 2006


		Sorry, I came in late...

   I believe someone mentioned document.forms[formIndex].controlName if you know where the form is in the order of forms -- if not, you can always just hit each form (can't be that many) and see if it has an element named "mydata".

   Another way would be to go ahead with getElementsByTagName and loop through the resulting array of fields, checking for each one's name and getting what you need.

   Beyond that, no, there's not really a "name" equivalent for getElementById.

At least I'm pretty sure of that...

Peter

				From: Terry Riegel riegel at clearimageonline.com

				On Oct 4, 2006, at 2:14 PM, Peter Brunone wrote:

   That's probably because "mydata" is the element's name attribute.  The tag name is "INPUT".

Cheers,
 > var nameArray = document.getElementsByTagName('mydata');

				Peter,

		Thanks, so what you are saying is that Triche's solution isn't going to work. So I am left with my original question.

				If I have a form element like
				<input type="text" name="mydata">
				Is there a way to select it in a similar manner to getElementById()?

		Terry

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20061004/e8206fce/attachment.htm>


More information about the Javascript mailing list