|
Posted by Martin Honnen on March 24, 2005, 5:12 pm
Please log in for more thread options
uvts_cvs@yahoo.com wrote:
> I have this html page and I expect a table with one row and two
> columns, the second column containing another table with one row and
> two columns.
>
> <html><body>
> <table border=1>
> <tr id=theRow>
> <td>firstCell</td>
> <script language=javascript>
> var row = document.getElementById("theRow");
>
> var cell = document.createElement("td");
>
> var subTable = document.createElement("table");
> subTable.border = 3;
HTML needs a tbody, the HTML/SGML parser adds that for you but when you
script the table then at least IE needs a tbody to be created e.g.
var tBody = document.createElement('tbody');
> var subRow = document.createElement("tr");
>
> var subCell1 = document.createElement("td");
> subCell1.innerHTML = "subCell1";
> var subCell2 = document.createElement("td");
> subCell2.innerHTML = "subCell2";
> subRow.appendChild(subCell1);
> subRow.appendChild(subCell2);
tbody.appendChild(subRow);
subTable.appendChild(tbody);
> cell.appendChild(subTable);
>
> row.appendChild(cell);
--
Martin Honnen
http://JavaScript.FAQTs.com/
|