title: Javascript inline output
body: <p>In javascript suppose you have this piece of code:</p>
  
  <pre><code>&lt;div&gt;
      &lt;script type="text/javascript"&gt;var output = 'abcdefg';&lt;/script&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Is there any way to simply "echo" (using PHP terminology) the contents of <code>output</code> into <code>#test</code>?  That is, to output a string inline, assuming you have no standard way of traversing or selecting from the DOM?</p>
  
  <p><code>document.write("...");</code> does write the contents of <code>output</code>, but in doing so, it replaces the entire document with the <code>output</code>. </p>
  
  <p>The solution I'm looking for should act the same way a PHP <code>echo</code> would: write the output into the document inline.</p>