Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving Tables values with Javascript

Status
Not open for further replies.

Draug

Programmer
Apr 18, 2001
77
CA
Hi,

In my HTML, I have a series of tables within a form. Each table has 6 text boxes from which I want to retrieve the text entered.

The form is called "mainMenu". The tables are called "table1", "table2", ... And, the text boxes are called "text1", "text2", ... (exciting huh?)

If I name the textboxes distinctly, I can get at the value as follows: mainMenu.myUniqueBox.value
However, I wish to name the tables distinctly and use the tables to get at the text boxes that are not unique. I thought the following would work (but it does not): mainMenu.myUniqueTable.myBox.value

Any ideas? Can you get to tables, table rows, and table cells from within JavaScript? If so, how?

I am not sure that I explained myself well. If clarification is needed, just ask.

Thank you for your help.
 
document.mainMenu.text1[0].value for the first one, document.mainMenu.text1[1].value for the second one, etc.

That should work... I added "document." in front because Netscape usually gets mad if you don't do that.

Hope that helped.
 
So, I see that if there are multiple names the same, they are stored in an array, one index for each duplicate.

Thanks for the info.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top