title: javascript - changing href of a link
body: <p>I've got a site which includes jQuery-Tabs, so I have a hashtag in my url to get a desired tab displayed:</p>
  
  <pre><code>www.abc.de/site#tab4
  </code></pre>
  
  <p>On this site I have a link which looks like this:</p>
  
  <pre><code>&lt;a href="/site.html?option=1" name="optionslink" id="optionslink" onclick="javascript:test()"&gt;LINKTEXT&lt;/a&gt;
  </code></pre>
  
  <p>With this link the user can choose an option for a product. The site gets reloaded on click. I want to achieve that on click the string after the hashtag in the url is read out and then this string will be added to the url or the link...</p>
  
  <p>My function looks like this:</p>
  
  <pre><code>function test() {
  var info=window.location.hash;
  alert(info);
  document.getElementById("optionslink").href+info;
  return true;
  }
  </code></pre>
  
  <p>So far the function is on click I get an alert-popup which shows the correct hashtag and it's string. But the site gets reloaded without having the hashtag+string added. It looks like this:</p>
  
  <pre><code>www.abc.de/site.html?option=1
  </code></pre>
  
  <p>It should look like:</p>
  
  <pre><code>www.abc.de/site.html?option=1#tab4
  </code></pre>
  
  <p>How can I get this working?</p>