title: How to assign Ajax callback to the script
body: <pre><code>&lt;html&gt;
    &lt;head&gt;
    &lt;script&gt;
    function sentAjax()
      {
      if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
        }
      else
        {// code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      xmlhttp.onreadystatechange=function()
        {
          //alert(xmlhttp.readyState);
        if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200)
          {
  
          document.getElementsByName('content') = xmlhttp.responseText;
  
          }
        }
      xmlhttp.open("GET","resultPage.php",true);
      xmlhttp.send();
      }
    &lt;/script&gt;
    &lt;script name="content"&gt;
       //should be assigned here
    &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Below is the result from "resultPage.php"</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
      objTreeMenu_1.drawMenu();
      objTreeMenu_1.writeOutput();
      objTreeMenu_1.resetBranches();
  
  &lt;/script&gt;
  </code></pre>
  
  <p>I would like to assign the above script to the inside <code>&lt;script name="content"&gt;&lt;/script&gt;</code>. However, I have tired the <code>document.getElementsByName('content') = xmlhttp.responseText;</code> which is wrong.</p>
  
  <p>Is there anyone can help me? Many thanks!</p>