<script type="text/javascript">
window.location.hash="Aboutus";
</script>
,我得到的URL#公司简介.. 我想这个标志更改为其他值..How我可以procees?
<script type="text/javascript">
window.location.hash="Aboutus";
</script>
,我得到的URL#公司简介.. 我想这个标志更改为其他值..How我可以procees?
你不能,散列在url中有特殊含义,它必须是散列,而不是任何其他符号。
尝试:
window.location.href += "#Abouts";
alert(location.hash.slice(1)); //Abouts
要更改URL,而不重新下载 - 你必须改变哈希值。你是对的。但哈希是#
后的所有符号。所以你不能改变它。
不能'#'具有语义含义。 – Hogan
我使用Ajax来加载我的网页..当我的ajax页面加载时,我需要更改网址,无需重新加载页面。而已。 –
更改url片段('#'后面的部分)不会导致页面重新加载 – detaylor