我有兩個頁面:一個是Main,一個是Popup,我抓取數據並提交回主頁面。它似乎可以在Chrome和FF中正常工作,但在IE中不起作用。我收到一條錯誤消息「沒有支持此類接口」。這似乎發生在我要求在IE上測試的每個人。Javascript插入動態行在主頁面
我認爲這與我將動態行追加到主頁面的方式有關。我只是不確定我該如何去做正確的事情。
這裏是我使用的代碼:
function addRowForPC(pcT,pcP) {
try {
var tableID="Equipment";
var table = window.opener.document.getElementById(tableID);
var rowCount = table.rows.length - 0;
var row = table.insertRow(rowCount);
insertFld("delEquip", "image" , table, rowCount, row, 0) //Image
insertFld(pcT , "text" , table, rowCount, row, 1) //Text
insertFld(pcP , "textSpan", table, rowCount, row, 2) //Text
}
catch(err) {
alert(err.message);
return "Fail";
}
}
//This calls: to create the rows:
function insertFld(fldName,fldType,table,rowCount,row,insCell) {
try {
var cellName = "cell" + (insCell+1);
cellName = row.insertCell(insCell);
switch (fldType) {
case "image":
var image = document.createElement('img');
image.src="Images/delete.jpg";
image.alt ="Remove";
image.name=fldName +rowCount;
image.setAttribute('width','10');
image.setAttribute('height','10');
image.onclick= function(){deleteRow(this)};
cellName.appendChild(image);
break;
case "text":
cellName.innerHTML = fldName;
break;
case "textSpan":
cellName.colSpan="2";
cellName.innerHTML = fldName;
break;
}
}
catch(err) {
alert (err.message);
}
}
任何幫助/指導將是巨大的。我是JavaScript/HTML的新手,所以我甚至不知道從哪裏開始使用jQuery。
謝謝。