document.getElementById("addDt").onclick = function () {
var tr = document.createElement("tr").setAttribute("class","info_tr");
tr.appendChild(id_td);
tr.appendChild(name_td);
tr.appendChild(gender_td);
}
问题背景:通过元素点击事件给tr赋值。
问题原因:创建tr元素时,用setAttribute。
解决方案:删除setAttribute:
document.getElementById("addDt").onclick = function () {
var tr = document.createElement("tr");
tr.appendChild(id_td);
tr.appendChild(name_td);
tr.appendChild(gender_td);
}