title: javascript runtime error 0x800a1391
body: <p>I'm learning a bit HMTL5 to prepare to the 70-480 exam. I'm trying to do some javascript code. It looks something like this: </p>
  
  <pre class="lang-js prettyprint-override"><code>function inchestometers(inches) {
      if (inches &lt; 0)
          return -1;
      else {
          var meters = inches / 39.37;
          return meters;
      }
  }
  
  var inches = 12;
  var meters = inchestometers(inches);
  document.write("the value in meters is " + meters);
  
  
  var hello = document.getElementById("hello");
  hello.firstChild.nodeValue = "Hello World";
  </code></pre>
  
  <p>and I have such html code: </p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
      &lt;title&gt;Htnl 5 test&lt;/title&gt;
      &lt;script src="script/test.js"&gt;&lt;/script&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;p id="hello"&gt;Hello&lt;/p&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>In my VS 2012 i have used the Asp.net Empty Web application project and added the Js file and also the html file. The problem is that The function runs properly without any exeptions. This function is taken from here: <a href="http://msdn.microsoft.com/en-us/library/cte3c772(v=vs.94).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/cte3c772(v=vs.94).aspx</a></p>
  
  <p>But whem I'm trying to run the code where I'm getting the document element it' crashint with the error like in the subject. What I've investigated is that the hello gets the null value. I've also tried the code thaken from here: </p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/yfc4b32c(v=vs.94).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/yfc4b32c(v=vs.94).aspx</a>  - the example with the div. I have the same effect. </p>
  
  <p>What is wrong? I know that there were simmilar subjects but I can't seem to find one matching to mine. Thank you kindly for your help. </p>
  
  <p>Regards
  Rafal</p>