Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could do something like this:</p> <pre><code>var test = '&lt;tr class="rowHeaders"&gt;'; test = test + '&lt;td id="sTD" name="sTD" width="4%"&gt;test.php&lt;/td&gt;' test = test + '&lt;td width="2%"&gt;&lt;input type="radio" name="tb" &gt;&lt;/td&gt;'; test = test + '&lt;td id="tTD" name="tTD" width="2%"&gt;php&lt;/td&gt;'; test = test + '&lt;td width="2%"&gt;&lt;input type="button" name="vv" &gt;&lt;/td&gt;'; test = test + '&lt;/tr&gt;'; var discardableElement = document.createElement("div"); discardableElement.innerHtml = test; var scriptTBL = document.getElementById("scriptsT"); scriptTBL.tBodies[0].appendChild(discardableElement.firstChild); </code></pre> <p>It's a little wasteful, since you're creating a DOM element (which is an expensive operation) only to discard it, but it will create the DOM elements to allow you to use the <code>appendChild</code> method.</p> <p>Alternatively, you could use string concatenation to use the innerHtml property, like this:</p> <pre><code>var test = '&lt;tr class="rowHeaders"&gt;'; test = test + '&lt;td id="sTD" name="sTD" width="4%"&gt;test.php&lt;/td&gt;' test = test + '&lt;td width="2%"&gt;&lt;input type="radio" name="tb" &gt;&lt;/td&gt;'; test = test + '&lt;td id="tTD" name="tTD" width="2%"&gt;php&lt;/td&gt;'; test = test + '&lt;td width="2%"&gt;&lt;input type="button" name="vv" &gt;&lt;/td&gt;'; test = test + '&lt;/tr&gt;'; var scriptTBL = document.getElementById("scriptsT"); // Insert at the BOTTOM of the table var newHtml = scriptTBL.innerHtml + test; // OR... Insert at the top of the table //var newHtml = test + scriptTBL.innerHtml; scriptTBL.tBodies[0].innerHtml = newHtml; </code></pre> <p><strong>EDIT:</strong> Updated based on @Zach's comment.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload