[javascript] Create table using Javascript

This should work (from a few alterations to your code above).

_x000D_
_x000D_
function tableCreate() {_x000D_
  var body = document.getElementsByTagName('body')[0];_x000D_
  var tbl = document.createElement('table');_x000D_
  tbl.style.width = '100%';_x000D_
  tbl.setAttribute('border', '1');_x000D_
  var tbdy = document.createElement('tbody');_x000D_
  for (var i = 0; i < 3; i++) {_x000D_
    var tr = document.createElement('tr');_x000D_
    for (var j = 0; j < 2; j++) {_x000D_
      if (i == 2 && j == 1) {_x000D_
        break_x000D_
      } else {_x000D_
        var td = document.createElement('td');_x000D_
        td.appendChild(document.createTextNode('\u0020'))_x000D_
        i == 1 && j == 1 ? td.setAttribute('rowSpan', '2') : null;_x000D_
        tr.appendChild(td)_x000D_
      }_x000D_
    }_x000D_
    tbdy.appendChild(tr);_x000D_
  }_x000D_
  tbl.appendChild(tbdy);_x000D_
  body.appendChild(tbl)_x000D_
}_x000D_
tableCreate();
_x000D_
_x000D_
_x000D_