E
ezmiller
So I have some code that gets the body element of another frame and
then tries to
dynamically write a table. The code fails when, after creating the
table, I try to
append it to the document. I get an invalid argument error.
Here's the code....
var docBody =
top.frames[frameName].document.getElementsByTagName("BODY")[0];
alert(docBody.tagName);
var t;
var r;
var c;
// Dynamically write out table and header row.
t = document.createElement("table");
r = t.insertRow();
c = document.createElement("td");
c.appendChild(document.createTextNode("Student Name"));
r.appendChild(c);
c = document.createElement("td");
c.appendChild(document.createTextNode("Test#1"));
r.appendChild(c);
c = document.createElement("td");
c.appendChild(document.createTextNode("Test#2"));
r.appendChild(c);
c = document.createElement("td");
c.appendChild(document.createTextNode("Test#3"));
r.appendChild(c);
c = document.createElement("td");
c.appendChild(document.createTextNode("Test#4"));
r.appendChild(c);
docBody.appendChild(t);
then tries to
dynamically write a table. The code fails when, after creating the
table, I try to
append it to the document. I get an invalid argument error.
Here's the code....
var docBody =
top.frames[frameName].document.getElementsByTagName("BODY")[0];
alert(docBody.tagName);
var t;
var r;
var c;
// Dynamically write out table and header row.
t = document.createElement("table");
r = t.insertRow();
c = document.createElement("td");
c.appendChild(document.createTextNode("Student Name"));
r.appendChild(c);
c = document.createElement("td");
c.appendChild(document.createTextNode("Test#1"));
r.appendChild(c);
c = document.createElement("td");
c.appendChild(document.createTextNode("Test#2"));
r.appendChild(c);
c = document.createElement("td");
c.appendChild(document.createTextNode("Test#3"));
r.appendChild(c);
c = document.createElement("td");
c.appendChild(document.createTextNode("Test#4"));
r.appendChild(c);
docBody.appendChild(t);