title: Is there a Simpler way to output a complete 'script' tag as text?
body: <p>I'm writing some AJAX that pulls in a web page that has the potential to have scripts and/or css that I'm trying to separate out into a couple of supporting fields in a form that runs all of this.</p>
  
  <p>I believe the pertinent code in this case is the AJAX finalizer.</p>
  
  <pre><code>xmlhttp.onreadystatechange=function()
  {
      if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200)
      {
          var JavascriptContent = document.getElementsByName('AgendaJS')[0];
          var CSSContent = document.getElementsByName('AgendaCSS')[0];
  
          var Parser = new DOMParser();
  
          var xmlData = Parser.parseFromString(xmlhttp.responseText, "text/html");
  
          var ResponseBody = xmlData.getElementsByTagName('body')[0];
  
          tinymce.activeEditor.setContent(ResponseBody.innerHTML);
  
          var ResponseScripts = xmlData.getElementsByTagName('script');
  
          var i = 0;
  
          for( i = i; i &lt;= ResponseScripts.length; i++ )
          {
              JavascriptContent.innerText += "\r\n" + String(ResponseScripts[i]);
          }
          return;
      }
  }
  </code></pre>
  
  <p>The idea here is to add any script tags ( preferably a direct copy of the full text ) to the 'AgendaJS' textarea. </p>
  
  <p>The way I see it right now, is that I am almost bound to examining the individual elements of the script tag and regenerating the entire tag from 'scratch' - so my hope here is that I can find a manner in which to dump this element into that field that doesn't yield this:</p>
  
  <pre><code>[object HTMLScriptElement]
  </code></pre>
  
  <p>I've glanced around at a few posts here and elsewhere that claim that a particular method works - but I am yet to confirm any of them.</p>
  
  <p>To be clear - I'd effectively like the resulting addition to the JS field to be the full tag and closing tag, like so:</p>
  
  <pre><code>&lt;script type="text/javascript" src="/tinymce/js/tinymce/tinymce.min.js"&gt;&lt;/script&gt;
  </code></pre>