title: executing javascript in PHP through echo, via ajax
body: <p>so i build a login user system that has int eh html page a div container and a javascript file. in the javascript file, it makes ajax calls to different php pages that then echo back the html code for the form selected that is then inserted into the div container. </p>
  
  <p>(Thus the page does not refresh - its dynamic content. and if someone grabs the source, all they get is the js file and a div container)</p>
  
  <p>my problem nw is i need to run some javascript in the echo'd html in the php that is being called via ajax.</p>
  
  <p>so ajax call to php, php echos a string and the ajax then performs a document.getElementById("Container").innerHTML=xmlhttp.responseText;</p>
  
  <p>The php code i have has a 2 input fields, and i need it to element .focus ont he first one. so i have something like this being echod'd:</p>
  
  <pre><code>echo "
  
  &lt;form&gt;
  &lt;input name='username' type='text' id='username'&gt;
  &lt;/form&gt;
  
  &lt;script type='text/javascript'&gt;
  document.getElementById('username').focus();
  &lt;/script&gt;
  
  ";
  </code></pre>
  
  <p>And guess what, it does not work..
  Please help </p>