Hi,
I'm trying to use the DOM to insert a TABLE into a DIV tag.
Can anyone tell me what I'm doing wrong here?
The code looks straightforward , but it is not working.
Thanks,
Dave
--------------------------------------------------------------
[HTML]<HTML>
<BODY>
<SCRIPT>
function InitPage() {
var text1 = document.create TextNode("cell contents")
var td1 = document.create Element("TD")
td1.appendChild (text1)
var tr1 = document.create Element("TR")
tr1.appendChild (td1)
var table1 = document.create Element("TABLE" )
table1.appendCh ild(tr1)
document.getEle mentById("text" ).appendChild(t able1)
}
</SCRIPT>
<DIV id=text>x</DIV>
<BR>
<INPUT type=button onclick=InitPag e() value=go!>
</BODY>
</HTML>[/HTML]
I'm trying to use the DOM to insert a TABLE into a DIV tag.
Can anyone tell me what I'm doing wrong here?
The code looks straightforward , but it is not working.
Thanks,
Dave
--------------------------------------------------------------
[HTML]<HTML>
<BODY>
<SCRIPT>
function InitPage() {
var text1 = document.create TextNode("cell contents")
var td1 = document.create Element("TD")
td1.appendChild (text1)
var tr1 = document.create Element("TR")
tr1.appendChild (td1)
var table1 = document.create Element("TABLE" )
table1.appendCh ild(tr1)
document.getEle mentById("text" ).appendChild(t able1)
}
</SCRIPT>
<DIV id=text>x</DIV>
<BR>
<INPUT type=button onclick=InitPag e() value=go!>
</BODY>
</HTML>[/HTML]
Comment