Accessing the javascript's global variable the second time results in undefined
<p>I have the following javascript code:</p>

<pre><code>&lt;script type="text/javascript"&gt;
   var x = 10;
   window.onload = function() {
      document.write(this.x); // &lt;-- yields correct output: 10.
      document.write(this.x); // &lt;-- outputs "undefined"
      document.write(this.x); // &lt;-- outputs "undefined"
   }
&lt;/script&gt;
</code></pre>

<p>I am unable to understand why [this.x] results in undefined from the second time onwards. If I am correct, the function context (value of "this"), would refer to the global window object.</p>
