这个源代码是什么导致它在 IE 中实际生成一个表,而不是什么都不做。
function generateATable()
{
tableContainer = document.getElementById("tableDiv");
var tableElement = document.createElement("table");
// Append the Table Element to the table
// container.
tableContainer.appendChild(tableElement);
// IE Requires a TBODY when dynamically generating
// tables. (I thought this was it but apparently it isn't)
var tbodyElement = document.createElement("tbody");
// First we'll append the tbody.
tableElement.appendChild(tbodyElement);
var trElement1 = document.createElement("tr");
// Next we'll append the first trElement to the
// tbody.
tbodyElement.appendChild(trElement1);
var aaCell = trElement1.insertCell(-1);
var abCell = trElement1.insertCell(0);
var textNodeAA = document.createTextNode("AA");
var textNodeAB = document.createTextNode("AB");
aaCell.appendChild(textNodeAA);
abCell.appendChild(textNodeAB);
tbodyElement.appendChild(trElement1);
var baCell = trElement1.cells[0].cloneNode(false);
var bbCell = trElement1.cells[1].cloneNode(false);
var textNodeBA = document.createTextNode("BA");
var textNodeBB = document.createTextNode("BB");
trElement2 = trElement1.cloneNode(false);
tbodyElement.appendChild(trElement2);
baCell.appendChild(textNodeBA);
bbCell.appendChild(textNodeBB);
trElement2.appendChild(baCell);
trElement2.appendChild(bbCell);
tableElement.style.border="4px solid black";
}
我很抱歉...这是其他问题...创建表格的数据没有填写,投票支持每个人...对不起!...