title: inject js to head (with full-code in script)
body: <p>I want to add a script to the head of a site so the the head of the target html looks like so <code>&lt;head&gt;&lt;script type="text/javascript"&gt;*some code...*&lt;/script&gt;&lt;/head&gt;</code>.</p>
  
  <hr>
  
  <p>With this script works that perfect:</p>
  
  <pre><code>var head = document.getElementsByTagName('head')[0],
      script = document.createElement('script');
  
  script.src = 'http://www.example.com/example.js';    
  head.appendChild(script);
  </code></pre>
  
  <hr>
  
  <p>But i don't want to use any link in source. </p>
  
  <p>So i'm tried to add some code like this:</p>
  
  <pre><code>    function addJS(jsCode) {
      var styleElement = document.createElement('script');
  
      styleElement.type = 'text/javascript';
  
         (scriptElement.javascript) {
          scriptElement.javascript.jsText = jsCode
          scriptElement.appendChild(document.createTextNode(jsCode))
  
      document.getElementsByTagName('head')[0].appendChild(scriptElement);
  }
  
  var jsCode = '';
  jsCode += 'code';
  jsCode += 'some more code';
  </code></pre>
  
  <hr>
  
  <p>But I've failed. That script is not working.</p>
  
  <p>How can I add a  Element to the head of any html site like this?
  Would be great if someone could help me.</p>