Open DestinyHunter opened 7 years ago
location.href就管理页面的url,用location.href=url就可以直接将页面重定向url。 而location.hash则可以用来获取或设置页面的标签值,也就是锚链接的值。
比如 http://domain/#admin 的 location.hash="#admin"
http://domain/#admin
location.hash="#admin"
this.hash:获取当前链接的标签值 如:
<a class="shortcut" href="#booking"></a> <script> $("b.shortcut").click(function(){ alert(this.hash); //输出#booking }); </script>
this.hash
location.href就管理页面的url,用location.href=url就可以直接将页面重定向url。 而location.hash则可以用来获取或设置页面的标签值,也就是锚链接的值。
比如
http://domain/#admin
的location.hash="#admin"
this.hash:获取当前链接的标签值 如: