window.location.hash.indexOf
2019年3月6日 1 min read
window.location.hash.indexOf()
用来获取#锚点和匹配参数
返回一个 URL 的主要部分。假设当前的 URL 是 http://www.runoob.com/test.htm#PART2:
document.write(location.hash);
输出:#part2
window.location.hash.indexOf()
用来获取#锚点和匹配参数
返回一个 URL 的主要部分。假设当前的 URL 是 http://www.runoob.com/test.htm#PART2:
document.write(location.hash);
输出:#part2