用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 2014-11-14 10:17  某猿  阅读(150)  评论(0编辑  收藏  举报