hash 属性是一个可读可写的字符串,该字符串是 URL 的锚部分(从 # 号开始的部分)。
语法
location.hash=anchorname
实例
假设当前的 URL 是:
location.hash=anchornamehttp://example.com:1234/test.htm#part2:
<html><body><script type="text/javascript">
document.write(location.hash);</script></body></html>
输出:
#part2
网友评论