HTML and CSS Reference
Figure 15.19 The blog entries are appended as they are added.
Creating a table with the DOM can be a little confusing to say the least. Just as we have
seen in previous examples, the DOM requires two steps: first, to create an empty element
with the createElement() method, and then to insert the element into the document tree
with the appendChild() or insertChild() method. That means for the table element, the
table heading, captions, rows and table data, and so on. you must create an empty ele-
ment and then place it in the tree. Forgetting a step will lead to a partial table or an
empty page. Using a DOM inspector can be very helpful when laying out a table, as
shown in Figure 15.20.
Firefox does not require either a tBody or a tFoot . Internet Explorer requires that you
create a tBody element and insert it into the table when using the DOM. Without it, you
will get a blank page. Because you are manipulating the document tree directly, Internet