hash属性

来源:互联网 发布:mrp软件下载 编辑:程序博客网 时间:2024/04/27 11:18

定义和用法
hash 属性是一个可读可写的字符串,该字符串是 URL 的锚部分(从 # 号开始的部分)。
语法
location.hash=anchorname
实例
假设当前的 URL 是: http://example.com:1234/test.htm#part2:

document.write(location.hash);



输出:

part2