这句代码有没有优化的空间或者是用其他更优的实现方式
var tab = document.getElementById('table');
for (var i = 0; i < 100; i++)
{
var newRow = tab.insertRow(tab.rows.length);
var newCell = newRow.insertCell();
newCell.innerText = i + 1;
newCell = newRow.insertCell();
newCell.name = 'td_' + i;
newCell.insertAdjacentHTML("BeforeEnd", "<input value='" + (i + 1) + "' style=TEXT-ALIGN:right NAME=xx >");
newCell = newRow.insertCell();
newCell.name = 'td_1' + i;
newCell.insertAdjacentHTML("BeforeEnd", "<input value='" + (i + 10) + "' style=TEXT-ALIGN:right NAME=yy >");
}
用JS在table中插入100行,每行3列。
这句代码有没有优化的空间或者是用其他更优的实现方式?????????/