function createTable(rows, cols) {
    var table = document.getElementById("table");
    table.width = "100%";
    while (table.hasChildNodes()) {
        table.removeChild(table.firstChild);
    }
    var td;
    for (var i = 0; i < rows; i++) {
        var tr = document.createElement('tr');
        for (var j = 0; j < cols; j++) {
            if (i == 0) { // first row contains header of table
                td = document.createElement('th');
            } else {
                td = document.createElement('td');
            }
            td.setAttribute('class', 'column');
            var textarea = document.createElement('textarea');
            textarea.setAttribute('class', 'table_text_area');
            td.appendChild(textarea);
            tr.appendChild(td);
        }
        table.appendChild(tr);
    }
}
/**
 * Create html table of given size and place it in #table. Each cell contains one text area.
 * @param rows number of rows
 * @param cols number of columns
 */
Create html table of given size and place it in #table. Each cell contains one text area.
@param rows number of rows
@param cols number of columns
Create html table of given size and place it in #table . Each cell contains one text area . @param rows number of rows @param cols number of columns
function createTable(rows, cols) {
    var table = document.getElementById("table");
    table.width = "100%";
    while (table.hasChildNodes()) {
        table.removeChild(table.firstChild);
    }
    var td;
    for (var i = 0; i < rows; i++) {
        var tr = document.createElement('tr');
        for (var j = 0; j < cols; j++) {
            if (i == 0) { 
                td = document.createElement('th');
            } else {
                td = document.createElement('td');
            }
            td.setAttribute('class', 'column');
            var textarea = document.createElement('textarea');
            textarea.setAttribute('class', 'table_text_area');
            td.appendChild(textarea);
            tr.appendChild(td);
        }
        table.appendChild(tr);
    }
}
function createTable ( rows , cols ) { var table = document . getElementById ( "table" ) ; table . width = "100%" ; while ( table . hasChildNodes ( ) ) { table . removeChild ( table . firstChild ) ; } var td ; for ( var i = 0 ; i < rows ; i ++ ) { var tr = document . createElement ( 'tr' ) ; for ( var j = 0 ; j < cols ; j ++ ) { if ( i == 0 ) { td = document . createElement ( 'th' ) ; } else { td = document . createElement ( 'td' ) ; } td . setAttribute ( 'class' , 'column' ) ; var textarea = document . createElement ( 'textarea' ) ; textarea . setAttribute ( 'class' , 'table_text_area' ) ; td . appendChild ( textarea ) ; tr . appendChild ( td ) ; } table . appendChild ( tr ) ; } }
Create html table of given size and place it in #table.
Create html table of given size and place it in #table .
// first row contains header of table