Click here to get back home

[newbie] client side jscript for a table inside a table

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
[newbie] client side jscript for a table inside a table uvts_cvs 03-24-2005
Posted by uvts_cvs on March 24, 2005, 8:01 am
Please log in for more thread options


Hi everybody,
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;

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);

subTable.appendChild(subRow);

cell.appendChild(subTable);

row.appendChild(cell);
</script>
</tr>
</table>
</body></html>

the problem is that with Internet Explorer Version: 6.0.2900.2180 I
only see the first column and the second one is empty while if I try iy
with FireFox 1.0.1 I get the expected result.

What I am missing?

Best regards.
Alessandro.



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/


Posted by uvts_cvs on March 24, 2005, 9:01 am
Please log in for more thread options



Martin Honnen wrote:
>
> 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.

Thank you very much, now I get it working fine.
Best Regards,
Alessandro.



Similar ThreadsPosted
client side image maps August 9, 2004, 7:04 pm
Post data to server from javascript on client side January 17, 2005, 3:47 pm
client-side image size changing question June 22, 2005, 6:26 am
table inside form? March 31, 2006, 10:50 pm
table inside div block - no joy April 2, 2006, 6:26 pm
DIVs inside table cells? April 13, 2008, 9:46 am
Newbie: Problems with table cells & colspan August 9, 2004, 7:11 pm
Newbie - Table resizing and latest technology November 8, 2004, 4:17 am
CSS property float: left inside table? July 19, 2007, 5:24 am
Image Positioning Inside Table Problem (IE only) January 2, 2008, 8:09 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap