It's not a secret anymore!*
The moose likes HTML, CSS and JavaScript and the fly likes Please help with the 3 Hardest Javascript problems in the world Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Please help with the 3 Hardest Javascript problems in the world" Watch "Please help with the 3 Hardest Javascript problems in the world" New topic
Author

Please help with the 3 Hardest Javascript problems in the world

YuenLian Wu
Ranch Hand

Joined: Nov 16, 2005
Posts: 73
Hi all JS experts,

I am so weak in Javascript, and I wish I can learn something from you guys from the stupid questions I asked.

Q1. I use a cooL javascript function "insertRow" to insert a new row at the end in my table. However, my table is not consistent, which means each row can be dynamic, some of the fields in the first row can be disappeared or became another type of elements. So, when I inserted a new row to the table, it follows the previous row style(number of fields, types) to insert a new row to my table, which betrayed me. I wish each new row should be insert in a way that the first row looks like, no matter how one of the row behaves. Is there any tricky way to do so ? I am freaking out !!!

Q2. I have another table has add and delete button to add or delete the rows dynamically. Normally, one of the combo box event will trigger another combo box to it. However, when multiple rows exerted, the combo box in the other rows will always trigger the combo box in the first row, not it's own row. I beleive it's my bug, however, I don't know how to fix it. My function is provided in the following:





Thanks for helping me

Transistor
Joel Jorgensen
Greenhorn

Joined: Oct 13, 2006
Posts: 22
Originally posted by YuenLian Wu:

Q1. I use a cooL javascript function "insertRow" to insert a new row at the end in my table. However, my table is not consistent, which means each row can be dynamic, some of the fields in the first row can be disappeared or became another type of elements. So, when I inserted a new row to the table, it follows the previous row style(number of fields, types) to insert a new row to my table, which betrayed me. I wish each new row should be insert in a way that the first row looks like, no matter how one of the row behaves. Is there any tricky way to do so ? I am freaking out !!!


Hi YuenLian,

From what I can tell about the insertRow table method, it by itself does not add any cells to the table. If you want your added row to look just like the first row of the table, I highly recommend that you clone the first row of your table and append it to the table. Regardless of what the other rows are, the new row will then be a copy of the first row in the table. Have a go at it, and then let me know if you'd like me to be more specific.


Go is to the fountain.
 
 
subject: Please help with the 3 Hardest Javascript problems in the world
 
Similar Threads
Multiple tables on one page
cant display the table
Hardest JavaScript Problem in the world so far
resultset is not working properly
adding and deleting a row in html