用insertRow,insertRow操作表格时,发现在谷歌浏览器中顺序和IE是反的
// 表格新增行
function addTableRow($id,$arr,$rowAttr){
var tableObj = document.getElementById($id);
var tBodyObj = tableObj.tBodies[0];
var rowObj = document.createElement("tr");
var cellObj;
if($rowAttr){
for(var i=0;i<$rowAttr.length;i++){
var rowAttribute = ($rowAttr[i]+":").split(":");
rowObj.setAttribute(rowAttribute[0],rowAttribute[1]);
}
}
for(var i=0;i<$arr.length;i++){
cellObj = document.createElement("td");
cellObj.innerHTML = $arr[i];
rowObj.appendChild(cellObj);
}
tBodyObj.appendChild(rowObj);
}
posted on
浙公网安备 33010602011771号