html tables, columns and javascript

While writing a little javascript today I needed to dynamically add or remove columns from a table based on user input. Well I see there is a insertRow to add a new row, fair enough, but no equivalent function appeared available to add a column.

Anyway I found a solution quick enough at http://www.mredkj.com/tutorials/tableaddcolumn.html

It basically involves iterating the rows in the table (or table section), and calling insertCell for each row.

Thanks to Keith Jenci for the tutorial.




You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply