Works with Mozilla, but not IE6. Need to fix it (ugh).
the script...
function maketable() {
var table = document.createElement("table");

var headerrow = document.createElement("tr");
var headercol1 = document.createElement("th");
var headercol2 = document.createElement("th");
var headercol3 = document.createElement("th");
headercol1.appendChild(document.createTextNode("col1"));
headercol2.appendChild(document.createTextNode("col2"));
headercol3.appendChild(document.createTextNode("col3"));
headerrow.appendChild(headercol1);
headerrow.appendChild(headercol2);
headerrow.appendChild(headercol3);
table.appendChild(headerrow);

var bodyrow = document.createElement("tr");
var bodycol1 = document.createElement("td");
var bodycol2 = document.createElement("td");
var bodycol3 = document.createElement("td");
bodycol1.appendChild(document.createTextNode("first entry"));
bodycol2.appendChild(document.createTextNode("second entry"));
bodycol3.appendChild(document.createTextNode("and the third"));
bodyrow.appendChild(bodycol1);
bodyrow.appendChild(bodycol2);
bodyrow.appendChild(bodycol3);
table.appendChild(bodyrow);

//document.body.appendChild(table, document.body.lastChild);
document.body.insertBefore(table, document.body.firstChild);
The button...
<form>
<input type="button" value="add the table" onclick="maketable(); return(false);">
</form>
the css...
table {padding: 2px; border-collapse: collapse;}
tr {vertical-align: top;}
th, td {border: 1px solid black;}