and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I am missing something here. The following is an example with two tables and two sets of buttons. The first has a div tag inside a table cell and the second has it inside the row.
In the first example I am using innerHTML to add data to the cell, add a new cell and add data to that. This works fine.
In the second example, I am trying to create the TD tag first and then add the same two cells - this does not work fine.
Anyone know why not?
[syntax="html"]<html>
<HEAD>
<SCRIPT>
function MyTest(){
document.all.a.innerHTML='cell1</TD><TD>cell2';
}
function MyTestErroneous(){
document.all.b.innerHTML='<TD>cell1</TD><TD>cell2</TD>';
}
</SCRIPT>
</HEAD>
<body>
<input type="button" value="go" onclick="MyTest();" />
<input type="button" value="check" onclick="alert(document.all.a.innerHTML);" />
<TABLE>
<TR><TD>
<DIV id="a" name="a"></DIV>
</TD>
</TR>
</TABLE>
<input type="button" value="go" onclick="MyTestErroneous();" />
<input type="button" value="check" onclick="alert(document.all.b.innerHTML);" />
<TABLE>
<TR>
<DIV id="b" name="b"></DIV>
</TR>
</TABLE>
</body>
</html>
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
personally, I wouldn't use innerHTML, but the DOM functionality to append another cell or whatever. Additionally, attempting to inject separate cells into a div will break in more standards compliant browsers.
have a search through the posts containing "createElement," "appendBefore," "appendChild," and "appendAfter"