Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you have access to the .js file in question, your best solution is going to be to modify the "document.write()" method and replace it with whatever makes sense in order to distribute the content contained within.</p> <p>The reasons for this are very well described above.</p> <p>If you are using document.write to write html tags to the page:</p> <pre><code>document.write("&lt;script src=...&gt;&lt;/script&gt;"); </code></pre> <p>or</p> <pre><code>document.write("&lt;img href=... /&gt;"); </code></pre> <p>Consider using the same sort of asynchronous format you've already been using:</p> <pre><code>// Add/Remove/Sugar these components to taste script = document.createElement("script"); script.onload = function () { namespaced.func.init(); }; script.src = "http://..."; document.getElementsByTagName("script")[0].parentNode.appendChild(script); </code></pre> <p>If you're looking to append DOM elements that are for the user to see and interact with, then you're better off either:</p> <p>a) Grabbing a specific containter (section/div) by id, and appending your content:</p> <pre><code>document.getElementById("price").innerHTML = "&lt;span&gt;$39.95&lt;/span&gt;"; </code></pre> <p>b) Building content off-DOM and injecting it into your container:</p> <pre><code>var frag = document.createDocumentFragment(), span = document.createElement("span"); span.innerText = "39.95"; frag.appendChild(span); document.getElementById("price").appendChild(frag); </code></pre> <p>Again, Sugar to your liking.</p> <p>If you DON'T have access to mod this second .js file, I'd suggest taking it up with them.</p>
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      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