R
robert.oschler
I have an AJAX driven page where I dynamically add rows to a known
table on the page, based on the return document from the AJAX call,
using DOM node methods (except for a small snippet of code, see below)
.. The code I use to do that is shown below.
The code runs fine in FireFox. I can see the newly created table rows
and everything looks fine on the page. In Internet Explorer, I don't
see any changes to the page after the new nodes are added.
I traced into the code using Microsoft's debugger. If I walk the child
nodes of the target table using the Immediate window (same as Mozilla
debugger's interactive window), I do see the newly created elements.
If I inspect the innerHTML of the new nodes I do see the HTML code in
proper format. But the page does not show the new elements at all.
Is this an Internet Explorer oddity and if so, what can I do to get
things working?
Thanks.
--------------------------
// Append the contents of TABLE in the "show links" DIV to the new
link.
// Helper function to build the mini table for the submitting user
name and notes.
function getShowLinkMiniTable(userName, notes)
{
var tblHtml =
"<TABLE ALIGN=LEFT VALIGN=TOP>\n" +
" <TR>\n" +
" <TD WIDTH=\"30%\">\n" +
" <P><b>Submitter:</b> " + userName + "</P>\n" +
" </TD>\n" +
" </TR>\n" +
" <TR>\n" +
" <TD WIDTH=\"70%\">\n" +
" <P><b>Notes:</b> " + notes + "</P>\n" +
" </TD>\n" +
" </TR>\n" +
"</TABLE>\n";
return tblHtml;
} // function getShowLinkMiniTable()
function appendShowLink(linkNum, linkHtml, userName, notes)
{
var tblShowLinks = document.getElementById("tblShowLinks");
if (!tblShowLinks)
{
alert("(appendShowLink) Unable to find the show links table.");
return;
}
// New row.
var trNew = document.createElement("TR");
// New cell - link num.
var pLinkNum = document.createElement("P");
pLinkNum.innerHTML = "" + linkNum;
var tdLinkNum = document.createElement("TD");
tdLinkNum.setAttribute("WIDTH", "10%");
tdLinkNum.setAttribute("VALIGN", "TOP");
// tdLinkNum.setAttribute("innerHTML", "" . linkNum);
tdLinkNum.appendChild(pLinkNum);
// New cell - link html.
var pLinkHtml = document.createElement("P");
pLinkHtml.innerHTML = linkHtml;
var tdLinkHtml = document.createElement("TD");
tdLinkHtml.setAttribute("WIDTH", "20%");
// tdLinkHtml.setAttribute("innerHTML", linkHtml);
tdLinkHtml.appendChild(pLinkHtml);
var tdUserMiniTable = document.createElement("TD");
tdUserMiniTable.setAttribute("WIDTH", "70%");
tdUserMiniTable.setAttribute("VALIGN", "TOP");
tdUserMiniTable.innerHTML = getShowLinkMiniTable(userName, notes);
// tdUserMiniTable.innerHTML = "<p>hello</p>";
// Add the cells to the row.
trNew.appendChild(tdLinkNum);
trNew.appendChild(tdUserMiniTable);
trNew.appendChild(tdLinkHtml);
// Add the new table data element to the table.
tblShowLinks.appendChild(trNew);
} // function setShowLinks()
table on the page, based on the return document from the AJAX call,
using DOM node methods (except for a small snippet of code, see below)
.. The code I use to do that is shown below.
The code runs fine in FireFox. I can see the newly created table rows
and everything looks fine on the page. In Internet Explorer, I don't
see any changes to the page after the new nodes are added.
I traced into the code using Microsoft's debugger. If I walk the child
nodes of the target table using the Immediate window (same as Mozilla
debugger's interactive window), I do see the newly created elements.
If I inspect the innerHTML of the new nodes I do see the HTML code in
proper format. But the page does not show the new elements at all.
Is this an Internet Explorer oddity and if so, what can I do to get
things working?
Thanks.
--------------------------
// Append the contents of TABLE in the "show links" DIV to the new
link.
// Helper function to build the mini table for the submitting user
name and notes.
function getShowLinkMiniTable(userName, notes)
{
var tblHtml =
"<TABLE ALIGN=LEFT VALIGN=TOP>\n" +
" <TR>\n" +
" <TD WIDTH=\"30%\">\n" +
" <P><b>Submitter:</b> " + userName + "</P>\n" +
" </TD>\n" +
" </TR>\n" +
" <TR>\n" +
" <TD WIDTH=\"70%\">\n" +
" <P><b>Notes:</b> " + notes + "</P>\n" +
" </TD>\n" +
" </TR>\n" +
"</TABLE>\n";
return tblHtml;
} // function getShowLinkMiniTable()
function appendShowLink(linkNum, linkHtml, userName, notes)
{
var tblShowLinks = document.getElementById("tblShowLinks");
if (!tblShowLinks)
{
alert("(appendShowLink) Unable to find the show links table.");
return;
}
// New row.
var trNew = document.createElement("TR");
// New cell - link num.
var pLinkNum = document.createElement("P");
pLinkNum.innerHTML = "" + linkNum;
var tdLinkNum = document.createElement("TD");
tdLinkNum.setAttribute("WIDTH", "10%");
tdLinkNum.setAttribute("VALIGN", "TOP");
// tdLinkNum.setAttribute("innerHTML", "" . linkNum);
tdLinkNum.appendChild(pLinkNum);
// New cell - link html.
var pLinkHtml = document.createElement("P");
pLinkHtml.innerHTML = linkHtml;
var tdLinkHtml = document.createElement("TD");
tdLinkHtml.setAttribute("WIDTH", "20%");
// tdLinkHtml.setAttribute("innerHTML", linkHtml);
tdLinkHtml.appendChild(pLinkHtml);
var tdUserMiniTable = document.createElement("TD");
tdUserMiniTable.setAttribute("WIDTH", "70%");
tdUserMiniTable.setAttribute("VALIGN", "TOP");
tdUserMiniTable.innerHTML = getShowLinkMiniTable(userName, notes);
// tdUserMiniTable.innerHTML = "<p>hello</p>";
// Add the cells to the row.
trNew.appendChild(tdLinkNum);
trNew.appendChild(tdUserMiniTable);
trNew.appendChild(tdLinkHtml);
// Add the new table data element to the table.
tblShowLinks.appendChild(trNew);
} // function setShowLinks()