js get part of the url
<p>I tried use js to change my url from </p>

<p><code>http://localhost/text/index.php#mainpage%20menu1</code></p>

<p>to</p>

<p><code>http://localhost/text/index.php#homepage%20menu1</code></p>

<p>My code not work, need a help, thanks.</p>

<pre><code>var curl = document.location.href;
var index = window.location.hash;
curl = index !== -1 ? index.split("%20",1) : null;
index = "homepage%20" + curl;
</code></pre>
