Solution: Obtain the table object and obtain an element under the corresponding row object below it. Here, for example, document.tableId.rows[i].cells[j] obtains the j-th element under the i-th row under the table. Then document.tableId.rows[i].cells[j].colspan=n.
eg:
dempTHFirst is the element to which row or column attributes are to be added.
demoThFirst.colSpan=3;