title: Is it possible to include HTML code in JavaScript?
body: <p>I have a basic question, can I include HTML code in JS? (with <code>document.write</code>)</p>
  <p>This is my HTML code:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;li&gt;&lt;a href=&quot;#&quot; class=&quot;menulink&quot;&gt;text&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#&quot; class=&quot;menulink&quot;&gt;text&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;#&quot; class=&quot;menulink&quot;&gt;text&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;
        &lt;a href=&quot;#&quot; class=&quot;sub&quot;&gt;text&lt;/a&gt;
        &lt;ul&gt;
          &lt;li class=&quot;topline&quot;&gt;&lt;a href=&quot;#&quot;&gt;text&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#&quot;&gt;text&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#&quot;&gt;text&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#&quot;&gt;text&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#&quot;&gt;text&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#&quot;&gt;text&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#&quot;&gt;text&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;a href=&quot;#&quot; class=&quot;sub&quot;&gt;text&lt;/a&gt;
        &lt;ul&gt;
          &lt;li class=&quot;topline&quot;&gt;&lt;a href=&quot;#&quot;&gt;text&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#&quot;&gt;text&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
  
      &lt;li&gt;
        &lt;a href=&quot;#&quot; class=&quot;sub&quot;&gt;text&lt;/a&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;a href=&quot;#&quot; class=&quot;sub&quot;&gt;text&lt;/a&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  
  &lt;li&gt;
    &lt;a href=&quot;#&quot; class=&quot;menulink&quot;&gt;text&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#&quot; class=&quot;menulink&quot;&gt;text&lt;/a&gt;&lt;/li&gt;
  </code></pre>
  <p>And I want to include it in this JS code:</p>
  <pre class="lang-js prettyprint-override"><code>window.onload = function () {
    document.getElementById(&quot;menu&quot;).innerHTML=&quot;&quot;;
  }
  </code></pre>
  <p>Connect it by this code:</p>
  <pre><code>&lt;p id=&quot;dropdown_menu&quot;&gt;&lt;/p&gt;
  </code></pre>
  <p>How can I do it?</p>
  <p><em>The full code is here</em> <a href="http://jsfiddle.net/tsnave/eSgWj/4/" rel="nofollow noreferrer">http://jsfiddle.net/tsnave/eSgWj/4/</a>
  thanks..</p>