File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Multiple tables on one page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Multiple tables on one page" Watch "Multiple tables on one page" New topic

Multiple tables on one page

JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
I finally made "add rows to a table" and "delete current row of the table" JavaScript work.

However, I have a number of tables within one single web page and "the" JavaScript feature must apply to every one of those tables.

I found that the JavaScript (see below) works only for the "last" table in that page. For example; say, I have Tables A (with its "id") and B (with its "id"). If I put the JavaScript for Table A only, everything works as expected. Thereafter, I modify the JavaScript wherever different name applies to Table B and add the script to my file. Everything works as expected for Table B but things stop working for Table A (there is no response at all when I click on the ADD button for Table A).

Please help for I can not figure out the problem. Thank you.

[ April 05, 2007: Message edited by: JiaPei Jen ]
[ April 05, 2007: Message edited by: Bear Bibeault ]
Herman Schelti
Ranch Hand

Joined: Jul 17, 2006
Posts: 387
hi JiaPei,

can you show us some of your html-code?

JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
Let me answer my own question.

The cause of my problem was that I had too many

The correct way to do is:

Thank you very much for your attention to my problem.
I agree. Here's the link:
subject: Multiple tables on one page
Similar Threads
how to implement dynamic rows paging when user clicks next or previous links
deleteing rows and storing row(text box) values in javascript
Add Rows dynamically to a table
Retrieving strings using getStrings() - DynaValidatorActionForm
getting reference of dynamically created field