Ajax - Load content into Textarea
<p>I have this simple ajax code, for some reason it wont load content onto textarea. I need it to load the content so that it can be edited in the textarea.</p>

<p>Here's the code, I'm not sure what I'm doing wrong. But it displays in a div like so  </p>

<pre><code>&lt;div id="content"&gt;&lt;/div&gt;
</code></pre>

<p>Here's the full code</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Editing Page Content&lt;/title&gt;

&lt;script type="text/javascript"&gt;
function showCustomer(str)
{
var xmlhttp;    
if (str=="")
  {
  document.getElementById("content").innerHTML="";
  return;
  }
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()
  {
  if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200)
    {
    document.getElementById("content").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","load.php?file="+str,true);
xmlhttp.send();
}
&lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;
    &lt;p&gt;Page Select to edit&lt;/p&gt;      

        &lt;?php  

             $result = mysql_query("SELECT pagename FROM site_content");            
                echo "&lt;select name=\"pagename\" onchange=\"showCustomer(this.value)\" style=\"width:300px;\"&gt;";             
                echo "&lt;option selected  value=''&gt;Please select a page to edit...&lt;/option&gt;";             
                 while($row = mysql_fetch_assoc($result)){ 
                 echo "&lt;option selected value='" . $row['pagename'] ."'&gt;" . $row['pagename'] . "&lt;/option&gt;\n";           
               }            
             echo "&lt;/select&gt;";          

             ?&gt;     

            &lt;div id="content"&gt;
                 **it works here**
             &lt;/div&gt;

            &lt;textarea cols="50" id="area1" style="position: absolute; width: 700px; height: 300px;"&gt;
                     **It won't work here**
            &lt;/textarea&gt;  

            &lt;input type="button" value="Submit content"&gt;  

            &lt;/div&gt;     
        &lt;/body&gt;             
&lt;/html&gt;
</code></pre>

<p>Any help would be appreciated.</p>
