This is a little different than the questions that have already been asked on this topic. I used that advice to turn a function like this:
function foo() {
document.getElementById('doc1').innerHTML = '<td>new data</td>';
}
into this:
function foo() {
newdiv = document.createElement('div');
newdiv.innerHTML = '<td>new data</td>';
current_doc = document.getElementById('doc1');
current_doc.appendChild(newdiv);
}
But this still doesn't work. An "unknown runtime error" occurs on the line containing innerHTML in both cases.
I thought creating the newdiv element and using innerHTML on that would solve the problem?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…