JmZ's example using jQuery is probably the best route you can take - it makes everything easier.

Also instead of using the ID's of your input fields, place an ID on each of the td tags the inputs are in, then use the same code. For IE6 however you may have to put a conditional statement in there and use table-row instead of block for display.

If you decide to take the jQuery route, then you should be fine using the input ID's although you will have empty table rows.