Detect change in URL hash usining JavaScript
<p>I'm working on a simple application which is single page based (due to project restrictions) and has dynamic content. I understand the dynamic content alright but what I don't understand is how to setup a script that changes the html of a div when the hashtag in the URL changes.</p>

<p>I need a JavaScript script to work as such:</p>

<p>Url: <code>http://foo.com/foo.html</code> div contents: <code>&lt;h1&gt;Hello World&lt;/h1&gt;</code></p>

<p>Url: <code>http://foo.com/foo.html#foo</code> div contents: <code>&lt;h1&gt;Foo&lt;/h1&gt;</code></p>

<p>How would this work?</p>

<p>Please help! Thanks.</p>
