Old question but if anybody still cares ...
I'll assume the <table> statement and the headings are already in the HTML but there is no "detail data" inside it and we want to add all that stuff. That is, the HTML includes
<table id="mytable">
<tr><th>ID</th> <th>Sec</th> <th>Div</th>
</table>
That's how I do it if I can so that you can readily see where the table goes when looking at the HTML, and you don't need possibly obscure code to put it in the right place. And you don't need code to create the th's, which is a bit more complicated than creating td's ... but that's another subject.
let table=document.getElementById("mytable")
let row=table.insertRow(-1)
let cell=row.insertCell(-1)
cell.rowSpan=3
cell.innerHTML="1"
let cell=row.insertCell(-1)
cell.innerHTML="S1"
let cell=row.insertCell(-1)
cell.innerHTML="D1"
row=table.insertRow(-1)
cell=row.insertCell(-1)
cell.innerHTML="S2"
cell=row.insertCell(-1)
cell.innerHTML="D2"
row=table.insertRow(-1)
cell=row.insertCell(-1)
cell.innerHTML="S3"
cell=row.insertCell(-1)
cell.innerHTML="D3"
// ... and then similarly for the second block
The trick here, to get "multiple rows in a cell", is rowSpan. That says that this cell takes up more than one row. Note that when you use rowSpan, the following row or rows should not have a cell where it would be "overlapped". That is, in this example where you have 3 columns but the first cell takes 3 rows, the next 2 rows should have only 2 columns each.
A logically simpler option is to put "S1
S2
S3" into the appropriate cell. The catch to this is that if you have multiple columns, text between columns might not line up. I had a table that I tried to do this way but the first column had radio buttons, which made each text line a little taller, so they didn't line up.
rowspan
attribute, or implement a table structure within each cell, for example – Thaumatropethis
is a keyword, don't use it as a parameter. – Brahe