How do external js work?? From what I've read this should work why doesn't it?
<p>I'm having a very simple problem understanding the scope of variables with external javascript pages.  From what I read if I call an external sheet all global functions and variables should be able to be accessed.  I can't seem to get it to work.  Knowing the right question to ask to search is the hard part and I could comb through the internet for days for a problem someone could probably explain easily and quickly.  I have seen something simliar in this tutorial <a href="http://www.tizag.com/javascriptT/javascriptexternal.php" rel="nofollow">http://www.tizag.com/javascriptT/javascriptexternal.php</a>,  I searched quickly stack found this: <a href="http://stackoverflow.com/questions/500431/javascript-variable-scope">JavaScript Variable Scope</a> and even as I write this I'm looking for the answer.  </p>

<p>Simply I have an external sheet in the same directory and the file name is trial.js. Then I have an index.html simply trying to use the global function from the external trial.js to the index page.  This is possible? according to the tizag tutorial using a function in the button onclick attribute.  Also many frameworks work on this principle too right?  Although I know they are a bit more sophisticated using $(a)&lt;~~~references?? or something.  Thanks for anyone's help I'll continue to look but hopefully the internet can help!!</p>

<p>localhost/trial.js:</p>

<pre><code>function trySomething(){
    alert("trying");
}
</code></pre>

<p>localhost/index.html:</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Objects222&lt;/title&gt;
&lt;script src="trial.js"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;script type="text/javascript"&gt;
        trySomething();
    &lt;/script&gt;
    Hello
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>It was originally in resource but I wanted to make it even simplier.  using firefox and chrome doesn't work for me???  Those who say it's working upon loading the page you get an alert that says "trying" ?  Anyone any ideas why it might not be working locally.  I cleared all my cache and tried renaming to force upload.  Also used Chrome, Firefox, and IE still no alert on load @ localhost.</p>
