title: Javascript: Function in a freshly opened window is not found
body: <p>I am coming from Java and try to learn Javascript right now. Doing that I have a problem to understand some behaviour I wrote.</p>
  
  <p>I like to have two windows. caller.html opens called.html and invokes a function called printMe().</p>
  
  <p>This is my code for caller.html:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt; PDSA #4.1 : Page 1 - Communication between Windows &lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;script&gt;
          fenster = open("called.html");
          fenster.printMe();
      &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>and this is called.html:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt; PDSA #4.1 : Page 2 - Communication between Windows &lt;/title&gt;
      &lt;script&gt;
          function printMe() {
              ausgabe = document.getElementById("toChange");
              ausgabe.innerHTML += "Changed!";
          }
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div id="toChange"&gt;&lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>Nothing happens when called.html is opened and from The Javascript Console in Chrome I can see the following error:</p>
  
  <pre><code>Uncaught TypeError: Object [object DOMWindow] has no method 'printMe'
  (anonymous function)
  </code></pre>
  
  <p>Newbish as I am I don't get it - why is printMe not found? The function is there and I see it in the code. Can you point me to the error?</p>
  
  <p>Thanks in advance for any hints
  André</p>