title: JavaScript error: "JavaScript runtime error: 'do_foo' is undefined
body: <p>I am using some JavaScript in my ASP.Net page like this:-</p>
  
  <pre><code>&lt;script type="text/javascript" src="MyScript.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      function validate_everything()
      {
          do_foo();
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>where <code>MyScript.js</code> exists in the same directory as the <code>Default.aspx</code>, and contains this (only):-</p>
  
  <pre><code>function do_foo()
  {
      var fred = 2;
      return fred;
  }
  </code></pre>
  
  <p>When I attempt to run this (using Internet Explorer) it produces the error:-</p>
  
  <pre><code>0x800a1391 - JavaScript runtime error: 'do_foo' is undefined
  </code></pre>
  
  <p>The real code (with actual useful work) handled in the same way was working fine yesterday, and fine earlier this morning. I modified it and this error started appearing; I reverted the changes and the error still appears. Before, using Chrome, the real version worked. Now, nothing happens (I assume the reason is the same).</p>
  
  <p>I appreciate this question is a hardy perennial. My problem differs from those <a href="https://stackoverflow.com/questions/16946547/javascript-runtime-error-is-undefined">here</a> and <a href="https://stackoverflow.com/questions/24396807/javascript-runtime-error-fidocallback-is-undefined">here</a> in that I'm not using JScript, and <a href="https://stackoverflow.com/questions/20100136/page-throws-javascript-runtime-error-function-name-is-undefined-ie10-only">this one</a> in that I'm not adding the script from the code-behind.</p>
  
  <p>I have used this approach in several other applications and the error does not occur there. Is that path going to pick up the file from the <code>Default.aspx</code> directory? Is there anything I need (in <code>web.config</code> or anywhere else) that I am lacking?</p>
  
  <p><strong>Edit</strong> on inspecting the page source (Chrome) the JavaScript in the <code>.aspx</code> file is listed as expected. The included file is shown thus:</p>
  
  <pre><code>&lt;script type="text/javascript" src="MyScript.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>but no script is shown (ought there to be?)</p>