title: XMLHttpRequest - Change Value with getElementById
body: <p>I want the button on the second page to change the value of the button in the first page,this is my code:</p>
  
  <p>FILE 1: Index.html(page one):</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd"&gt;
  
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
  &lt;title&gt;Eran Exercise&lt;/title&gt;
  &lt;link rel="stylesheet" type="text/css" href="design.css" /&gt;
  &lt;script src="new_file.js"&gt;&lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
      &lt;div class="wrapper"&gt;
  
          &lt;form&gt; 
  &lt;input type="button" id="id200" value="New Window!" onClick="window.open('page2.html','mywindow','width=400,height=200')"&gt; 
  
  &lt;/form&gt; 
  
                      &lt;/div&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>FILE 2:new_file.js(the js file)</p>
  
  <pre><code>function changeLink()
  {
  var someOtherName="after click";
  
  xmlhttp=new XMLHttpRequest();
  
  xmlhttp.onreadystatechange=function()
    {
    if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200)
  {
  document.getElementById("id200").value = someOtherName;
  }
   }
  xmlhttp.open("GET","index.php");
  xmlhttp.send();
  }
  </code></pre>
  
  <p>FILE 3:page2.html (page two)</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd"&gt;
  
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;script src="new_file.js"&gt;&lt;/script&gt;
   &lt;/head&gt;
  
  &lt;body&gt;
  &lt;input type="button" id="id100" onclick="changeLink()" value="Change link"&gt;
  &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre>
  
  <p>Thanks!</p>