Adding dynamic row and control into a table through javascript

How to add TR , TD and Controls into a table from javascript:-
here is a example to add row and file upload into table dynamiclly.
while table row cantain 3 cell.



var count = 0;

function addrow() {

    var row = dynamicTbl.insertRow(dynamicTbl.rows.length - 3);
    row.id = "inserted_file[" + count + "]";
    var cell = row.insertCell(0);
    var cell0 = row.insertCell(1);
    cell0.collspan = 2;
    cell0.innerHTML = '<input type="file" style="width:280px" align="left" name="new_file[' + count + ']" id="new_file[' + count + ']" />';
   ++count;

}

Popular Posts