File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Using InnerHTML to Add Dynamic Rows to Table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Using InnerHTML to Add Dynamic Rows to Table" Watch "Using InnerHTML to Add Dynamic Rows to Table" New topic
Author

Using InnerHTML to Add Dynamic Rows to Table

Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 569
I want to add some rows to a table dynamically. With DOM, I need to do many document.createElement() to create the <tr>,<td> and lots of other formatting elements. But is there a simplier way to do this? MSDN says .innerHTML for <tr> is readonly so I cannot simply modify this property.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You have the option of using createElement or insertRow()/insertCell()

Eric
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Using InnerHTML to Add Dynamic Rows to Table
 
Similar Threads
Help me to have a sortable table in my html profile!
window.print() not working IE
make array of hidden fields
Scrolling problem with JSF
Supplying value to innerHTML