Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem with DOM in IE
    primarykey
    data
    text
    <p>I wonder if IE doesn't support DOM method when creating a table in a containing element-div. Because I could not see the table when the JavaScript rendered. Please see the following:</p> <p>In the HTML:</p> <pre><code>&lt;div id="pageHeader"&gt; &lt;div id="filters"&gt; ----- &lt;/div&gt; &lt;/div&gt; </code></pre> <p>In the JavaScript:</p> <p>I created a div named "classifications". Then I have two sub divs. </p> <ol> <li><code>&lt;div id="titleClass"&gt;</code></li> <li><code>&lt;div id="namesClass"&gt;</code></li> </ol> <p>Also, I have one table in number 2. The problem is that div number 2 and its child-table is not seen on screen.</p> <p>Any solution, please?</p> <p>Here is the code: supposing that "classifications" is already defined.</p> <pre><code>function loading(){ initClassifications(); } function initClassifications() { if (classifications.length &gt; 0) { var el = document.createElement("div"); el.setAttribute("id", "classifications"); ul1 = document.createElement("ul"); startIndex1 = 0; var pageHeader = document.getElementById("pageHeader"); var titleElement = document.createElement("span"); var titleText = document.createTextNode("classifications"); titleElement.appendChild(titleText); var lstElement = document.createElement("div"); lstElement.setAttribute("id", "titleClass"); lstElement.appendChild(titleElement); el.appendChild(lstElement); //add title to classifications var names = document.createElement("div"); // create div for classifications names.setAttribute("id", "namesClass"); var tbl = document.createElement("table"); var tr = document.createElement("tr"); var td = document.createElement("td"); for (var i = 0 ; i &lt; classifications.length &amp;&amp; i&lt; 10 ; i++) { var li = document.createElement("li"); ul1.appendChild(li); names.appendChild(ul1); var link = document.createElement("a"); link.setAttribute("href", classifications[i][0]); var name = document.createTextNode(classifications[i][1]); link.appendChild(name); li.appendChild(link); startIndex1++; } td.appendChild(ul1); tr.appendChild(td); if (startIndex1 &lt; classifications.length) { var span = document.createElement("span"); var link = document.createElement("a"); link.setAttribute("href", "javascript:addClassifications();"); var text = document.createTextNode("more..."); link.appendChild(text); span.appendChild(link); moreClass = document.createElement("div"); //more div for moving moreClass.setAttribute("id", "moreClass"); moreClass.appendChild(span); el.appendChild(moreClass); var td1 = document.createElement("td"); td1.setAttribute("valign", "bottom"); td1.appendChild(moreClass); tr.appendChild(td1); } tbl.appendChild(tr); el.appendChild(tbl); names.appendChild(tbl); el.appendChild(names); pageHeader.appendChild(el); var filter = document.getElementById("filters"); pageHeader.insertBefore(el, filter); //insert listingnames before filters } } function addClassifications() { var maxIndex = startIndex1 + 10; for (var i = startIndex1; i &lt; classifications.length &amp;&amp; i&lt;maxIndex; i++) { var li = document.createElement("li"); ul1.appendChild(li); var link = document.createElement("a"); link.setAttribute("href", classifications[i][0]); var name = document.createTextNode(classifications[i][1]); link.appendChild(name) li.appendChild(link); startIndex1++; } //if (startIndex1 &gt;= classifications.length) // $$("#moreClass").remove(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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