Window.location.hash not working in safari, chrome & mozilla

I have a jscript that I added a line of code to to allow me to have a clever way of showing hidden divs further down the page.

This is my script and it seems to work in I.E, but not in the others, so was wondering if anybody could help me with this.

<script language="javascript" type="text/javascript">
function showonlyonev2(thechosenone) {
      var newboxes = document.getElementsByTagName("div");
      for(var x=0; x<newboxes.length; x++) {
            name = newboxes[x].getAttribute("name");
            if (name == 'newboxes-2') {
                  if (newboxes[x].id == thechosenone) {
                        if (newboxes[x].style.display == 'block') {
                              newboxes[x].style.display = 'none';
                        else {
                              newboxes[x].style.display = 'block';
                  }else {
                        newboxes[x].style.display = 'none';
	  window.location.hash = "#info";

And this is the other bit.

<a name="Info" id="Info2"></a>

If it helps this is the page.

It supposed to work when you click one of the titles in the 4 categories across the middle of the page. eg Medieval Banquets, Weddings etc

It seems to be setting the hash for me in Chrome and Firefox.

Hi, do you mean that yes the hash is being set in the url, but is the page moving to see the then open hidden div at the bottom of the screen.

Or am I mad, and it all works OK for you.

Ahh, you’re wanting other side-effects to occur. It sets the hash in the url.

If you want the page to scroll to the element identified as “Info”, you will need to set the hash to that instead. Pay attention to the capitalisation.

OMG! I dont believe that, I didnt make both capitals…

I’m sorry to waste your time guys.

Now presumably you’ll turn your attention to creating a fallback, so that those ‘links’ aren’t inexplicably broken if JS is disabled or unavailable.

A good way to do that is to have the link href go to “#Info” so that the script isn’t solely responsible for setting that hash.

Right yes I didnt think of that, will do that thank you.