hash

2016-03-16  本文已影响0人  hanjy

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
上一篇 下一篇

猜你喜欢

热点阅读