Example: working around innerText and document.write

M-Business JavaScript engine does not support innerText or document.write.

innerText

Working around the absence of innerText is fairly straightforward. For example, instead of:

Cell.innerText = I;

You can use:

Cell.appendChild(document.createTextNode(I));
document.write

For document.write, the workaround depends on the complexity of the inserted content.

  • You can sometimes use the visibility attribute to hide then reveal content.

  • Another option is to use a Clone Node.

  • Another option that works for more complex structures is to use createObject, as in the following example:

    var oTable = document.createElement("TABLE");
    var oTBody0 = document.createElement("TBODY");
    oTable.appendChild(oTBody0);
    var oRow, oCell;
    var I;
    for( I=0; I < 5; I++) {
         oRow = document.createElement("TR");
         oTBody0.appendChild(oRow);
         oCell = document.createElement("TD");
         oCell.appendChild(document.createTextNode(I));
         oRow.appendChild(oCell);
         }
    var oTableContainer = document.getElementById("oTableContainer");
    oTableContainer.appendChild(oTable);