I\'m using this javascript code to have a couple \"show/hide\" toggled divs on my site:
This is not the javascript answer that you want, but you could try playing around with the :target
pseudo selector. For instance,
show this with #foo.
#bar shows this.
Example: http://jsfiddle.net/ZAHns/4/ (thanks to Jared for the idea of adding the anchors).
Depending on what you are trying to do, this could possibly work, but think your requirements through.
Note: Take this response with a HUGE grain of salt -- don't use it.
To answer the actual question, use the following to determine if the hash is present:
var in_hash = location.hash.slice(1) === what_you_are_looking_for;
if (in_hash) ? /* IN HASH */ : /* NOT IN HASH */;