Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Multiple Textboxes with same name


Message #1 by "Chris Cote" <cotec@s...> on Fri, 5 Apr 2002 16:29:42
try this..

var oList = window.document.getElementsByName("text1");	// text1 is the name
of the text box
for (i=0;i<oList.length;i++)
{
	alert(oList[i].value);
}

Suresh

-----Original Message-----
From: Chris Cote [mailto:cotec@s...]
Sent: Friday, April 05, 2002 11:30 AM
To: JavaScript HowTo
Subject: [javascript_howto] Multiple Textboxes with same name


I am having trouble with an ASP form I'm working on.  I had all the text 
boxes for one section with the same name.  The thing I can't figure out is 
how to get the values from each text box with Javascript.  Does anyone 
know what to do? I've been trying:

var inputArray = document.form0.colWidth;
var arrayLength = inputArray.length;

and going through the inputArray to get the values, but I keep getting an 
error saying that " 'length' is null or not an object".

Can you please help me?

Chris Cote

---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20



"The information in this email, and in any attachments,
may contain confidential information and is intended 
solely for the attention and use of the named addressee(s).
It must not be disclosed to any person without authorization.
If you are not the intended recipient, or a person responsible for
delivering it to the intended recipient, you are not authorized
to, and must not, disclose, copy, distribute, or retain this
message or any part of it."

  Return to Index