title: how to replace part of the URL with JavaScript?
body: <p>I have something like <a href="http://domain.com/Pages/SearchResults.aspx?function=search&amp;selectedserver=intranet&amp;search_query=MyRecords" rel="noreferrer">http://domain.com/Pages/SearchResults.aspx?function=search&amp;selectedserver=intranet&amp;search_query=MyRecords</a> and need to replace it by JavaScript with something similar to <a href="http://domain.com/Pages/SearchResults.aspx?function=loginsearch&amp;user=admin&amp;password=admin&amp;selectedserver=intranet&amp;search_query=MyRecords" rel="noreferrer">http://domain.com/Pages/SearchResults.aspx?function=loginsearch&amp;user=admin&amp;password=admin&amp;selectedserver=intranet&amp;search_query=MyRecords</a> — so </p>
  
  <pre><code>function=search 
  </code></pre>
  
  <p>is being replaced with </p>
  
  <pre><code>function=loginsearch&amp;user=admin&amp;password=admin
  </code></pre>
  
  <p>inside the URL. Need help with what JavaScript should I save as a button on a browser's tool bar to click and have the URL in the address bar replaced.</p>