This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Please help with the 3 Hardest Javascript problems in the world

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
    Bookmark Topic Watch Topic
  • New Topic