Test appendChild

by slawe

HTML

<div id="theBlah">d</div>

JavaScript

var blah="Blah!";
      var t  = document.createElement("table"),
      tb = document.createElement("tbody"),
      tr = document.createElement("tr"),
      td = document.createElement("td");

      t.style.width = "100%";
      t.style.borderCollapse = 'collapse';

      td.appendChild(document.createTextNode(blah)); 

      // note the reverse order of adding child        
      tr.appendChild(td);
      tb.appendChild(tr);
      t.appendChild(tb);

      document.getElementById("theBlah").appendChild(t);