Information Systems



How do you add a row in an html table using javascript

function addRow()
{
var _body = document.getElementById('table1').tBodies[0];
var _row = _body.insertRow(-1);
var _cell = _row.insertCell(0);
_cell.innerHTML = 'col1';
_cell = _row.insertCell(1);
_cell.innerHTML = 'col2';
}