How to use javascript in href to call function and use anchor text

What I have is a situation where I am using java script to open and close div’s but those divs are down the page with some of the links I’m using.

So what I want to do is use achor text, but I dont know if I can.

below is the code.


<div style="border: 1px solid #ffffff; background-color: #221816; padding: 6px; position:relative; float:left; left:-3px; font-size:14px;">
<a id="myHeader1-2" href="javascript:showonlyonev2('newboxes1-2');" >Medieval Banquets</a>
</div>

What I would like to do is add #info to pick up an anchor further down the page, so something liek this:


<div style="border: 1px solid #ffffff; background-color: #221816; padding: 6px; position:relative; float:left; left:-3px; font-size:14px;">
<a id="myHeader1-2" href="javascript:showonlyonev2('newboxes1-2');[B]#info[/B]" >Medieval Banquets</a>
</div>

Can this be done?

OK I worked it out.

Rather than trying to attach the #info in the link part, I moved it to the end of the script itself.


<script language="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 = "http://www.mywebsite.co.uk/index.php#info"
}
</script>

Cheers for those who looked